home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / util / pclnglsh / part01 next >
Encoding:
Internet Message Format  |  1990-10-14  |  71.3 KB

  1. Path: wuarchive!cs.utexas.edu!usc!elroy.jpl.nasa.gov!abcfd20.larc.nasa.gov!amiga-request
  2. From: amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i287: pcl2english - debug/understand HP Printer Control Language, Part01/02
  5. Message-ID: <comp.sources.amiga:v90i287@abcfd20.larc.nasa.gov>
  6. Date: 14 Oct 90 19:39:36 GMT
  7. Reply-To: Allen Norskog <allen@hpfcacn.fc.hp.com>
  8. Lines: 2770
  9. Approved: tadguy@uunet.UU.NET (Tad Guy)
  10. X-Mail-Submissions-To: amiga@uunet.uu.net
  11. X-Post-Discussions-To: comp.sys.amiga
  12.  
  13. Submitted-by: Allen Norskog <allen@hpfcacn.fc.hp.com>
  14. Posting-number: Volume 90, Issue 287
  15. Archive-name: util/pcl2english/part01
  16.  
  17. [ uuencoded executable and input file enclosed  ...tad ] 
  18.  
  19. Pcl2english was designed to help debug and understand printouts that
  20. use the Hewlett Packard Printer Control Language (PCL).  For example,
  21. when pcl2english encounters the "escape sequence" for setting the
  22. margins, it will print out the escape sequence that was
  23. used and a brief English translation of what it means.
  24.  
  25.  
  26. #!/bin/sh
  27. # This is a shell archive.  Remove anything before this line, then unpack
  28. # it by saving it into a file and typing "sh file".  To overwrite existing
  29. # files, type "sh file -c".  You can also feed this as standard input via
  30. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  31. # will see the following message at the end:
  32. #        "End of archive 1 (of 2)."
  33. # Contents:  README asterisk.c chart externals.c externals.h gdefs.h
  34. #   getopt.c main.c makefile paren.c pcl_good.uu protos.h utils.c
  35. # Wrapped by tadguy@abcfd20 on Sun Oct 14 15:39:33 1990
  36. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  37. if test -f 'README' -a "${1}" != "-c" ; then 
  38.   echo shar: Will not clobber existing file \"'README'\"
  39. else
  40. echo shar: Extracting \"'README'\" \(9972 characters\)
  41. sed "s/^X//" >'README' <<'END_OF_FILE'
  42. X                            PCL2ENGLISH
  43. X                            Version 2.0
  44. X
  45. X                        Author: Allen Norskog
  46. X                         September 15, 1990
  47. X
  48. X
  49. XPUBLIC DOMAIN NOTICE
  50. X
  51. XThis program is placed in Public Domain.  It may be freely copied.
  52. XI developed this program to suit my own needs.  I hope it will be
  53. Xuseful to others.  The source is included so that you can make
  54. Xmodifications to suit your own needs.  I would appreciate any 
  55. Xcomments or bug reports.
  56. X
  57. X
  58. XDESCRIPTION
  59. X
  60. XPcl2english was designed to help debug and understand printouts that
  61. Xuse the Hewlett Packard Printer Control Language (PCL).  For example,
  62. Xwhen pcl2english encounters the "escape sequence" for setting the
  63. Xmargins, it will print out the escape sequence that was
  64. Xused and a brief English translation of what it means.
  65. X
  66. XI have frequently done this process by hand and its quite tedious.
  67. XFirst one (typically) prints the characters out in hex so that
  68. Xthe "escape" character, 1B (hex), can be seen.  By slowly going back
  69. Xand forth between the hex printout and the printer manual, you can
  70. Xdecode the escape sequences and start to determine what the  printer
  71. Xwas asked to do.
  72. X
  73. XPcl2english was designed to reduce the tedium and chance for errors
  74. Xwith this formerly manual process.  You will still need to use your
  75. Xprinter manual to more clearly understand page size, margin settings,
  76. Xfont selection and your printer's capabilities.  But hopefully, you
  77. Xcan quickly answer questions such as:  Why did part of my print out
  78. Xcome out on the second page?
  79. X
  80. XIt has been my experience that each program seems to have its own
  81. Xphilosophy of how to print.  Pcl2english is a tool to understand
  82. Xthese "philosophies" and give insight as to when you can get a program
  83. Xto do something you want (say print in landscape) and when you can't.
  84. X
  85. XI have personally used a number of the Hewlett-Packard printers:
  86. XThinkJet, DeskJet, PaintJet, LaserJet+, and the LaserJet IIP.  The
  87. Xprogram handles the escape sequences used by these printers and also
  88. Xthe LaserJet 500+, DeskJet+, and LaserJet IID.  Pcl2english does
  89. Xnot handle new features introduced with the LaserJet III.
  90. X
  91. X
  92. XREVISION HISTORY
  93. X
  94. XVersion 1.x:  Internal development versions.
  95. X
  96. XVersion 2.0:  First release of pcl2english.
  97. X
  98. X
  99. XRUNNING PCL2ENGLISH
  100. X
  101. XPcl2english is strictly a "text" based program.  The command format is:
  102. X
  103. Xpcl2english [options] infile [outfile]
  104. X
  105. X    options:
  106. X
  107. X    -e  print escape sequences and certain control codes only.   Normal
  108. X        text sequences are  not printed, though they are used to keep
  109. X        track of where  the "cursor" is.
  110. X    -v  print version number on the first output line.
  111. X    -x  print hexadecimal equivalents.  After the escape sequence, special
  112. X        character, or line of text is printed, a line is printed that
  113. X        contains the hex values for each character.
  114. X
  115. X    infile:  "pcl" input file.  This should be a capture of the exact
  116. X             data being sent to the printer.  That is, any data
  117. X             translation ("cooking") should have already been done.
  118. X             Methods to get this will vary with machine/operating system.
  119. X    outfile: optional output file.  If not given, output is sent to stdout.
  120. X             The output is plain ASCII text.
  121. X
  122. X
  123. XPCL2ENGLISH OUTPUT
  124. X
  125. XA short example to illustrate various features follows:
  126. X
  127. X
  128. X<Esc>(s10h1T
  129. X    <Esc>(s10h  primary font characters per inch = 10
  130. X    <Esc>(s1T   primary font typeface = Pica
  131. X
  132. X<Esc>&d@
  133. X    <Esc>&d@    Disable Underline
  134. X
  135. X<Esc>(sbS
  136. X    <Esc>(sb    primary font weight = Medium (0)
  137. X    <Esc>(sS    primary font style = Upright
  138. X
  139. X<Esc>9
  140. X    <Esc>9      Reset Left and Right Margins to default settings.
  141. X
  142. X<Esc>&l002e062F
  143. X    <Esc>&l002e Top margin = 2 lines.  Text length defaults to:
  144. X                    page_length - top_margin - half_inch
  145. X    <Esc>&l062F Text length = 62 lines
  146. X
  147. X1<LF>2<LF>3<LF>4<LF>
  148. X    Added 4 more lines.
  149. X
  150. X<Form feed>  Move to first line at top of next page
  151. X             while maintaining current column at 4.
  152. X
  153. X<LF>
  154. X    Added 1 more lines.
  155. X
  156. X----------------------------------------------------------------------
  157. X
  158. XSpecial characters are enclosed in <>'s such as the escape and form feed.
  159. X
  160. XEach new group of special characters is printed starting at the left edge.
  161. X
  162. XMultiple  escape commands can be grouped together.  The actual
  163. Xdecoding for each "sub" command is done on subsequent indented
  164. Xlines following the command group listing. The <Esc>(sbS command
  165. Xabove is an example of this.
  166. X
  167. XText is condensed to fit on a single line.  This is done by printing
  168. Xup to 20 characters.  If more than 20 characters were encountered,
  169. Xthe first and last 10 characters are printed separated by " ... ".
  170. XSpecial characters are printed between <>'s. A space at the beginning
  171. Xor the end will be printed as <SP> so that it does not get "lost".
  172. XThe program counts the number of line feeds encountered in a text
  173. Xsection.  If any are seen, it will print the number of lines added.
  174. XThis number includes any <LF>'s that may be visible in the text line.
  175. X
  176. XA form feed causes the present page to be ejected.  However, the
  177. Xcursor is not automatically moved over to the left margin on the
  178. Xnext page.  Thus, a "current column" is maintained and printed when
  179. Xa form feed is encountered.  This column is affected by left and
  180. Xright margin settings, tabs, returns, and standard characters.
  181. XHowever, pcl2english isn't smart about proportional fonts and some
  182. Xof the cursor positioning commands.  Thus, the current column value is
  183. Xreally only a help, and not to be relied upon when doing fancy stuff.
  184. X
  185. XThe "-x" hex option will print out a line of hex equivalents, as can
  186. Xbe seen in the following example.  Here, the second line repeats the
  187. Xfirst line, but in hex.  The other lines are like in the example above.
  188. X
  189. X<Esc>(s10h1T
  190. X1B 28 73 31 30 68 31 54
  191. X    <Esc>(s10h  primary font characters per inch = 10
  192. X    <Esc>(s1T   primary font typeface = Pica
  193. X
  194. X
  195. XIn many cases, you can interchange printer drivers.  Often, you can
  196. Xuse a LaserJet driver on a DeskJet, or a DeskJet driver on a LaserJet.
  197. XHowever, there are differences between the various printers that
  198. Xcould cause differences in the printout.  For example, the DeskJet
  199. Xis restricted in its ability to move the page back up.  Thus, a
  200. XLaserJet command to move the cursor (paper) back could be ignored
  201. Xon a DeskJet.  Pcl2english was designed to recognize commands for
  202. Xa wide variety of printers, rather than be specific to one particular
  203. Xprinter.  Thus, if you decode something with pcl2english, and it
  204. Xdoesn't seem that your printer is responding properly to a particular
  205. Xescape sequence, check in your printer manual to see if that sequence
  206. Xis indeed supported.
  207. X
  208. X
  209. XERRORS
  210. X
  211. XBelow are a couple examples of error messages that one could get.
  212. XBasically, these escape sequences are undefined, though they could
  213. Xbe used on a future printer.  If you encounter one of these, check
  214. Xyour printer manual.
  215. X
  216. X<Esc>A
  217. X    <Esc>A      WARNING!!!  Improper/unknown escape sequence.
  218. X
  219. X<Esc>&d5D
  220. X    <Esc>&d5D   Underline control = ???
  221. X
  222. X
  223. XCOMPILING NOTES
  224. X
  225. XPcl2english was developed on an Amiga.  However it does not take
  226. Xadvantage of any Amiga specific features, and should be able to
  227. Xrun on a variety of machines.  You will need to make changes in
  228. Xthe compile options in the makefile to match your compiler.  The
  229. Xone feature that this program does take advantage of is prototypes
  230. Xthat are defined in ANSI C.
  231. X
  232. X
  233. XMISCELLANEOUS
  234. X
  235. XIncluded with this program are two files called "chart" and "pcl_good".
  236. X"chart" is a reference sheet that lists escape sequences in
  237. Xalphabetical order.  "pcl_good" is a test file of all escape sequences
  238. Xhandled by pcl2english.  This was one of the files used to test
  239. Xthe program.  You can test the program by running:
  240. X
  241. X    pcl2english -e pcl_good
  242. X
  243. XI should mention that my employer is Hewlett-Packard.  Though I have
  244. Xused a variety of HP printers, I do not design/build printers for HP.
  245. XMy main motivation for this program comes as an owner and user.
  246. X
  247. X
  248. XAMIGA NOTES
  249. X
  250. XThere are three "printer devices" on the Amiga:  PRT:, PAR:, and SER:.
  251. XThe PRT: device will route output to the appropriate parallel or
  252. Xserial port (PAR: or SER:) based on your Preferences setting.  The
  253. XPRT: device also "cooks" its input by converting "generic" escape
  254. Xsequences to the proper escape sequences used by your printer.  These
  255. Xconversions are handled in the printer driver that is selected in
  256. XPreferences.  (For example, the HP_DeskJet or HP_LaserJet printer
  257. Xdrivers.)  What pcl2english wants is the PCL data being sent to PAR:
  258. X(or  SER: if you connect your printer to the serial port.)
  259. X
  260. XA program called CMD is available for capturing exactly this data.
  261. XIt is in the Utilities drawer for the Workbench 1.3 release.  It is
  262. Xalso on Fred Fish Disk #95.  You need to be sure that if Preferences
  263. Xwants to send printer output to the parallel port, that you specify
  264. X"parallel" in CMD.  Similarly if you use the serial port.  You will
  265. Xwant to decide where you want to create the new file.  For short cases,
  266. Xyou may want to use ram memory since it is fast.  For example,
  267. Xyou might want FILE=RAM:CMD_file.  For longer outputs, or something
  268. Xyou want to save, you may give a hard disk or floppy file name.
  269. X
  270. XAfter the file(s) has been created, you can run pcl2english on it
  271. Xto see the escape sequences.  Running CMD a second time will turn
  272. Xoff the re-direction, and allow you to send to the printer again.
  273. XYou can now send the file captured by CMD to the printer by saying:
  274. Xcopy file PAR:  (or SER:).  The file is already "cooked", so you
  275. Xwant to send it directly to PAR: rather than PRT:.
  276. X
  277. XTo run pcl2english, you will need to open up a CLI or Shell window.
  278. XThen type in the command as shown above.  If pcl2english is not
  279. Xin one of your "path" directories, then you will also need to specify
  280. Xthe path to it so the computer can find it.
  281. X
  282. XPcl2english was developed on the Manx Aztec C 5.0c compiler using
  283. X32 bit ints.
  284. X
  285. X--------------------------
  286. X
  287. XAllen Norskog
  288. X900 Whaler's Way
  289. XFort Collins, CO  80525
  290. X
  291. X--------------------------
  292. END_OF_FILE
  293. if test 9972 -ne `wc -c <'README'`; then
  294.     echo shar: \"'README'\" unpacked with wrong size!
  295. fi
  296. # end of 'README'
  297. fi
  298. if test -f 'asterisk.c' -a "${1}" != "-c" ; then 
  299.   echo shar: Will not clobber existing file \"'asterisk.c'\"
  300. else
  301. echo shar: Extracting \"'asterisk.c'\" \(11928 characters\)
  302. sed "s/^X//" >'asterisk.c' <<'END_OF_FILE'
  303. X/* $RCSfile: asterisk.c,v $  $Revision: 2.0 $ */
  304. X
  305. X#include <stdio.h>
  306. X#include "gdefs.h"
  307. X#include "externals.h"
  308. X#include "protos.h"
  309. X
  310. Xextern FILE *ifile,*ofile;
  311. X
  312. Xstatic int    fill_area = 0; /* Start with set to black fill (default) */
  313. X
  314. Xstatic char        *compress[] = {
  315. X    "Unencoded",
  316. X    "Run-Length Encoded",
  317. X    "Tagged Image File Format (TIFF)",
  318. X};
  319. X
  320. Xstatic char        *font_ctl[] = {
  321. X    "Delete all soft fonts",
  322. X    "Delete all temporary soft fonts",
  323. X    "Delete soft font (last ID specified)",
  324. X    "Delete character code (last ID and character code)",
  325. X    "Make soft font temporary (last font ID specified)",
  326. X    "Make soft font permanent (last font ID specified)",
  327. X    "Copy/Assign current invoked font as temporary",
  328. X};
  329. X
  330. Xstatic char        *fill_patterns[] = {
  331. X    "???",
  332. X    "Horizontal Lines",
  333. X    "Vertical Lines",
  334. X    "Diagonal Lines ///",
  335. X    "Diagonal Lines \\\\\\",
  336. X    "Square Grid",
  337. X    "Diagonal Grid",
  338. X};
  339. X
  340. Xstatic char        *fill_types[] = {
  341. X    "Solid area (black)",
  342. X    "White",
  343. X    "Shaded",
  344. X    "HP defined pattern",
  345. X};
  346. X
  347. Xstatic char        *fill_pct[] = {
  348. X    "0",
  349. X    "1-2",
  350. X    "2-10",
  351. X    "10-20",
  352. X    "20-35",
  353. X    "35-55",
  354. X    "55-80",
  355. X    "80-99",
  356. X    "100",
  357. X};
  358. X
  359. Xstatic char        *graphics_mode[] = {
  360. X    "Image in orientation of logical page (rotate image)",
  361. X    "???",
  362. X    "???",
  363. X    "Image along width of physical page (landscape compatible)",
  364. X};
  365. X
  366. Xstatic char        *graphics_quality[] = {
  367. X    "Default (high)",
  368. X    "Draft",
  369. X    "High",
  370. X};
  371. X
  372. Xvoid decode_asterisk(void)        /* <Esc>* */
  373. X{
  374. X    int         start_pos;
  375. X    int         stop_pos;
  376. X    int         i;
  377. X    int         done;
  378. X    char     c1,c2,c3;
  379. X
  380. X    c1 = esc_string[1];
  381. X    c2 = esc_string[2];
  382. X    c3 = esc_string[3];
  383. X    if (c2 == 'b') {
  384. X        start_pos = stop_pos = 3;
  385. X        done = FALSE;
  386. X        while (done == FALSE) {
  387. X            get_num(&stop_pos,0);
  388. X            c3 = esc_string[stop_pos];
  389. X            if (raster_mode == NO_RASTER) {
  390. X                print_sub_string(2, start_pos, stop_pos);
  391. X            }
  392. X            switch (c3) {
  393. X                case 'm':
  394. X                case 'M':
  395. X                    fprintf(ofile,"Compression mode = ");
  396. X                    if ((num >= 0) && (num <= 2)) {
  397. X                        fprintf(ofile,"%s\n",compress[num]);
  398. X                    }
  399. X                    else {
  400. X                        fprintf(ofile,questions);
  401. X                    }
  402. X                    break;
  403. X                case 'V':    /* Can't have 'v' */
  404. X                case 'W':    /* Can't have 'w' */
  405. X                    if (raster_mode != NO_RASTER) {
  406. X                        /* Count number of "extra" (other than first)
  407. X                           like lines */
  408. X                        raster_count++;    
  409. X                    }
  410. X                    else {
  411. X                        if (c3 == 'V') {
  412. X                            raster_mode = V_RASTER;
  413. X                            fprintf(ofile,
  414. X                                "Next %d bytes form one plane ",num);
  415. X                            fprintf(ofile,
  416. X                                "of raster graphics data (PaintJet).\n");
  417. X                        }
  418. X                        else {
  419. X                            raster_mode = W_RASTER;
  420. X                            fprintf(ofile,
  421. X                                "Next %d bytes form (final) plane ",num);
  422. X                            fprintf(ofile,
  423. X                                "of raster graphics data.\n");
  424. X                        }
  425. X                        for (i=0; i<=stop_pos; i++) {
  426. X                            raster_header[i] = esc_string[i];
  427. X                        }
  428. X                        raster_header[i] = 0;
  429. X                        raster_count = 0;
  430. X                    }
  431. X                    for (i=0; i<num; i++) {
  432. X                        c1 = getc(ifile);
  433. X                    }
  434. X                    done = TRUE;
  435. X                    break;
  436. X                case 'x':
  437. X                case 'X':
  438. X                    fprintf(ofile,"Horizontal offset = ");
  439. X                    if ((num >= 0) && (num <= 32767)) {
  440. X                        fprintf(ofile,"%d pixels\n",num);
  441. X                    }
  442. X                    else {
  443. X                        fprintf(ofile,out_of_range,num);
  444. X                    }
  445. X                    break;
  446. X                case 'y':
  447. X                case 'Y':
  448. X                    fprintf(ofile,"Vertical offset = ");
  449. X                    if ((num >= -5) && (num <= 32767)) {
  450. X                        fprintf(ofile,"%d pixels\n",num);
  451. X                    }
  452. X                    else {
  453. X                        fprintf(ofile,out_of_range,num);
  454. X                    }
  455. X                    break;
  456. X                default:
  457. X                    fprintf(ofile,"%s",bad_esc);
  458. X                    break;
  459. X            }
  460. X            stop_pos++;
  461. X            start_pos = stop_pos;
  462. X            if (esc_string[start_pos] == 0) {
  463. X                done = TRUE;
  464. X            }
  465. X        }
  466. X    }
  467. X    else if (c2 == 'c') {
  468. X        start_pos = stop_pos = 3;
  469. X        done = FALSE;
  470. X        while (done == FALSE) {
  471. X            get_num(&stop_pos,0);
  472. X            c3 = esc_string[stop_pos];
  473. X            print_sub_string(2, start_pos, stop_pos);
  474. X            switch (c3) {
  475. X                case 'a':
  476. X                case 'A':
  477. X                    fprintf(ofile,"Horizontal rectangle size = ");
  478. X                    if ((num >= 0)) {
  479. X                        fprintf(ofile,"%d dots (300 dpi)\n",num);
  480. X                    }
  481. X                    else {
  482. X                        fprintf(ofile,out_of_range,num);
  483. X                    }
  484. X                    break;
  485. X                case 'b':
  486. X                case 'B':
  487. X                    fprintf(ofile,"Vertical rectangle size = ");
  488. X                    if ((num >= 0)) {
  489. X                        fprintf(ofile,"%d dots (300 dpi)\n",num);
  490. X                    }
  491. X                    else {
  492. X                        fprintf(ofile,out_of_range,num);
  493. X                    }
  494. X                    break;
  495. X                case 'd':
  496. X                case 'D':
  497. X                    fprintf(ofile,"Specify Font ID to be ");
  498. X                    if ((num >= 0) && (num <= 32767)) {
  499. X                        fprintf(ofile,"%d\n",num);
  500. X                    }
  501. X                    else {
  502. X                        fprintf(ofile,out_of_range,num);
  503. X                    }
  504. X                    break;
  505. X                case 'e':
  506. X                case 'E':
  507. X                    fprintf(ofile,"Specify the character code to be ");
  508. X                    if ((num >= 0) && (num <= 255)) {
  509. X                        fprintf(ofile,"%d\n",num);
  510. X                    }
  511. X                    else {
  512. X                        fprintf(ofile,out_of_range,num);
  513. X                    }
  514. X                    break;
  515. X                case 'f':
  516. X                case 'F':
  517. X                    fprintf(ofile,"Font/character control =\n");
  518. X                    indent(5);
  519. X                    if ((num >= 0) && (num <= 6)) {
  520. X                        fprintf(ofile,"%s\n",font_ctl[num]);
  521. X                    }
  522. X                    else {
  523. X                        fprintf(ofile,questions);
  524. X                    }
  525. X                    break;
  526. X                case 'g':
  527. X                case 'G':
  528. X                    fprintf(ofile,"Area fill ID = ");
  529. X                    switch (fill_area) {
  530. X                        case 0:
  531. X                            fprintf(ofile,
  532. X                                "Not appropriate for solid fill\n");
  533. X                            break;
  534. X                        case 1:
  535. X                            fprintf(ofile,
  536. X                                "Not appropriate for white fill\n");
  537. X                            break;
  538. X                        case 2:
  539. X                            if ((num >= 0) && (num <= 100)) {
  540. X                                i = 0;
  541. X                                if (num < 1) num = 0;
  542. X                                else if (num <= 2) i = 1;
  543. X                                else if (num <= 10) i = 2;
  544. X                                else if (num <= 20) i = 3;
  545. X                                else if (num <= 35) i = 4;
  546. X                                else if (num <= 55) i = 5;
  547. X                                else if (num <= 80) i = 6;
  548. X                                else if (num <= 99) i = 7;
  549. X                                else i = 8;
  550. X                                fprintf(ofile,"%s %s\n",fill_pct[i],"%");
  551. X                            }
  552. X                            else {
  553. X                                fprintf(ofile,questions);
  554. X                            }
  555. X                            break;
  556. X                        case 3:
  557. X                            if ((num >= 0) && (num <= 6)) {
  558. X                                fprintf(ofile,"%s\n",fill_patterns[num]);
  559. X                            }
  560. X                            else {
  561. X                                fprintf(ofile,questions);
  562. X                            }
  563. X                            break;
  564. X                        default:    /* Shouldn't happen */
  565. X                            fprintf(ofile,"%s",bad_esc);
  566. X                            break;
  567. X                    } /* end switch */
  568. X                    break;
  569. X                case 'h':
  570. X                case 'H':
  571. X                    fprintf(ofile,"Horizontal rectangle size = ");
  572. X                    if ((num >= 0)) {
  573. X                        fprintf(ofile,"%d/720 inch\n",num);
  574. X                    }
  575. X                    else {
  576. X                        fprintf(ofile,out_of_range,num);
  577. X                    }
  578. X                    break;
  579. X                case 'p':
  580. X                case 'P':
  581. X                    fprintf(ofile,"Fill rectangular area = ");
  582. X                    if ((num >= 0) && (num <= 3)) {
  583. X                        fill_area = num;
  584. X                        fprintf(ofile,"%s fill\n",fill_types[num]);
  585. X                    }
  586. X                    else {
  587. X                        fprintf(ofile,questions);
  588. X                    }
  589. X                    break;
  590. X                case 'v':
  591. X                case 'V':
  592. X                    fprintf(ofile,"Vertical rectangle size = ");
  593. X                    if ((num >= 0)) {
  594. X                        fprintf(ofile,"%d/720 inch\n",num);
  595. X                    }
  596. X                    else {
  597. X                        fprintf(ofile,out_of_range,num);
  598. X                    }
  599. X                    break;
  600. X                default:
  601. X                    fprintf(ofile,"%s",bad_esc);
  602. X                    break;
  603. X            }
  604. X            stop_pos++;
  605. X            start_pos = stop_pos;
  606. X            if (esc_string[start_pos] == 0) {
  607. X                done = TRUE;
  608. X            }
  609. X        }
  610. X    }
  611. X    else if (c2 == 'p') {
  612. X        start_pos = stop_pos = 3;
  613. X        done = FALSE;
  614. X        while (done == FALSE) {
  615. X            get_num(&stop_pos,0);
  616. X            c3 = esc_string[stop_pos];
  617. X            print_sub_string(2, start_pos, stop_pos);
  618. X            switch (c3) {
  619. X                case 'x':
  620. X                case 'X':
  621. X                    if (plus) {
  622. X                        fprintf(ofile,
  623. X                            "Move cursor right %d dots (300 dpi)\n",num);
  624. X                    }
  625. X                    else if (minus) {
  626. X                        fprintf(ofile,
  627. X                            "Move cursor left %d dots (300 dpi)\n",-num);
  628. X                    }
  629. X                    else {
  630. X                        fprintf(ofile,
  631. X                            "Move cursor to %d/300 inch ",num);
  632. X                        fprintf(ofile,
  633. X                            "from left boundary of page.\n");
  634. X                    }
  635. X                    break;
  636. X                case 'y':
  637. X                case 'Y':
  638. X                    if (plus) {
  639. X                        fprintf(ofile,
  640. X                            "Move cursor down %d dots (300 dpi)\n",num);
  641. X                    }
  642. X                    else if (minus) {
  643. X                        fprintf(ofile,
  644. X                            "Move cursor up %d dots (300 dpi)\n",-num);
  645. X                    }
  646. X                    else {
  647. X                        fprintf(ofile,
  648. X                            "Move cursor to %d/300 inch ",num);
  649. X                        fprintf(ofile, "down from top margin.\n");
  650. X                    }
  651. X                    break;
  652. X                default:
  653. X                    fprintf(ofile,"%s",bad_esc);
  654. X                    break;
  655. X            }
  656. X            stop_pos++;
  657. X            start_pos = stop_pos;
  658. X            if (esc_string[start_pos] == 0) {
  659. X                done = TRUE;
  660. X            }
  661. X        }
  662. X    }
  663. X    else if (c2 == 'r') {
  664. X        start_pos = stop_pos = 3;
  665. X        done = FALSE;
  666. X        while (done == FALSE) {
  667. X            get_num(&stop_pos,0);
  668. X            c3 = esc_string[stop_pos];
  669. X            print_sub_string(2, start_pos, stop_pos);
  670. X            switch (c3) {
  671. X                case 'a':
  672. X                case 'A':
  673. X                    fprintf(ofile,"Start raster graphics.\n");
  674. X                    indent(5);
  675. X                    if (num == 0) {
  676. X                        fprintf(ofile,
  677. X                            "Graphics start at left-most printable region.\n");
  678. X                    }
  679. X                    else if (num == 1) {
  680. X                        fprintf(ofile,
  681. X                            "Set starting position and left graphics margin\n");
  682. X                        indent(5);
  683. X                        fprintf(ofile,"to current position.\n");
  684. X                    }
  685. X                    else {
  686. X                        fprintf(ofile,questions);
  687. X                    }
  688. X                    break;
  689. X                case 'b':
  690. X                case 'B':
  691. X                    fprintf(ofile,"End raster graphics.\n");
  692. X                    if (num != 0) {
  693. X                        fprintf(ofile,questions);
  694. X                    }
  695. X                    break;
  696. X                case 'f':
  697. X                case 'F':
  698. X                    fprintf(ofile,"Raster graphics mode =\n");
  699. X                    indent(5);
  700. X                    if ((num >= 0) && (num <= 3)) {
  701. X                        fprintf(ofile,"%s\n",graphics_mode[num]);
  702. X                    }
  703. X                    else {
  704. X                        fprintf(ofile,questions);
  705. X                    }
  706. X                    break;
  707. X                case 'k':
  708. X                case 'K':
  709. X                    fprintf(ofile,"Return Model number\n");
  710. X                    if (num != 0) {
  711. X                        fprintf(ofile,questions);
  712. X                    }
  713. X                    break;
  714. X                case 'q':
  715. X                case 'Q':
  716. X                    fprintf(ofile,"Graphics quality = ");
  717. X                    if ((num >= 0) && (num <= 2)) {
  718. X                        fprintf(ofile,"%s\n",graphics_quality[num]);
  719. X                    }
  720. X                    else {
  721. X                        fprintf(ofile,questions);
  722. X                    }
  723. X                    break;
  724. X                case 's':
  725. X                case 'S':
  726. X                    fprintf(ofile,"Image width (pixels/row) = ");
  727. X                    if ((num >= 0) && (num <= 32767)) {
  728. X                        fprintf(ofile,"%d\n",num);
  729. X                    }
  730. X                    else {
  731. X                        fprintf(ofile,out_of_range,num);
  732. X                    }
  733. X                    break;
  734. X                case 'u':
  735. X                case 'U':
  736. X                    fprintf(ofile,"Number of color planes per row = ");
  737. X                    if ((num >= 1) && (num <= 4)) {
  738. X                        fprintf(ofile,"%d\n",num);
  739. X                    }
  740. X                    else {
  741. X                        fprintf(ofile,out_of_range,num);
  742. X                    }
  743. X                    break;
  744. X                default:
  745. X                    fprintf(ofile,"%s",bad_esc);
  746. X                    break;
  747. X            }
  748. X            stop_pos++;
  749. X            start_pos = stop_pos;
  750. X            if (esc_string[start_pos] == 0) {
  751. X                done = TRUE;
  752. X            }
  753. X        }
  754. X    }
  755. X    else if (c2 == 't') {
  756. X        start_pos = stop_pos = 3;
  757. X        done = FALSE;
  758. X        while (done == FALSE) {
  759. X            get_num(&stop_pos,0);
  760. X            c3 = esc_string[stop_pos];
  761. X            print_sub_string(2, start_pos, stop_pos);
  762. X            switch (c3) {
  763. X                case 'r':
  764. X                case 'R':
  765. X                    fprintf(ofile,"Resolution (dots per inch) = ");
  766. X                    switch (num) {
  767. X                        case 75:
  768. X                        case 100:
  769. X                        case 150:
  770. X                        case 300:
  771. X                        case 90:
  772. X                        case 180:
  773. X                            fprintf(ofile,"%d\n",num);
  774. X                            break;
  775. X                        default:
  776. X                            fprintf(ofile,"%d ???\n",num);
  777. X                            break;
  778. X                        }
  779. X                    break;
  780. X                default:
  781. X                    fprintf(ofile,"%s",bad_esc);
  782. X                    break;
  783. X            }
  784. X            stop_pos++;
  785. X            start_pos = stop_pos;
  786. X            if (esc_string[start_pos] == 0) {
  787. X                done = TRUE;
  788. X            }
  789. X        }
  790. X    }
  791. X    else if (c2 == 'v') {
  792. X        start_pos = stop_pos = 3;
  793. X        done = FALSE;
  794. X        while (done == FALSE) {
  795. X            get_num(&stop_pos,0);
  796. X            c3 = esc_string[stop_pos];
  797. X            print_sub_string(2, start_pos, stop_pos);
  798. X            switch (c3) {
  799. X                case 'a':
  800. X                case 'A':
  801. X                    fprintf(ofile,"Red component = ");
  802. X                    if ((num >= 4) && (num <= 90)) {
  803. X                        fprintf(ofile,"%d\n",num);
  804. X                    }
  805. X                    else {
  806. X                        fprintf(ofile,out_of_range,num);
  807. X                    }
  808. X                    break;
  809. X                case 'b':
  810. X                case 'B':
  811. X                    fprintf(ofile,"Green component = ");
  812. X                    if ((num >= 4) && (num <= 88)) {
  813. X                        fprintf(ofile,"%d\n",num);
  814. X                    }
  815. X                    else {
  816. X                        fprintf(ofile,out_of_range,num);
  817. X                    }
  818. X                    break;
  819. X                case 'c':
  820. X                case 'C':
  821. X                    fprintf(ofile,"Blue component = ");
  822. X                    if ((num >= 6) && (num <= 85)) {
  823. X                        fprintf(ofile,"%d\n",num);
  824. X                    }
  825. X                    else {
  826. X                        fprintf(ofile,out_of_range,num);
  827. X                    }
  828. X                    break;
  829. X                case 'i':
  830. X                case 'I':
  831. X                    fprintf(ofile,"Put color into palette at index ");
  832. X                    if ((num >= 0) && (num <= 15)) {
  833. X                        fprintf(ofile,"%d\n",num);
  834. X                    }
  835. X                    else {
  836. X                        fprintf(ofile,out_of_range,num);
  837. X                    }
  838. X                    break;
  839. X                default:
  840. X                    fprintf(ofile,"%s",bad_esc);
  841. X                    break;
  842. X            }
  843. X            stop_pos++;
  844. X            start_pos = stop_pos;
  845. X            if (esc_string[start_pos] == 0) {
  846. X                done = TRUE;
  847. X            }
  848. X        }
  849. X    }
  850. X}
  851. END_OF_FILE
  852. if test 11928 -ne `wc -c <'asterisk.c'`; then
  853.     echo shar: \"'asterisk.c'\" unpacked with wrong size!
  854. fi
  855. # end of 'asterisk.c'
  856. fi
  857. if test -f 'chart' -a "${1}" != "-c" ; then 
  858.   echo shar: Will not clobber existing file \"'chart'\"
  859. else
  860. echo shar: Extracting \"'chart'\" \(8877 characters\)
  861. sed "s/^X//" >'chart' <<'END_OF_FILE'
  862. XSpecial characters
  863. X
  864. X            Hex Dec
  865. XBS    <CTRL H>  8     8    Backspace.    Move one column left.
  866. XLF    <CTRL J>  A 10    Line feed.  Move to next line, same column.
  867. XFF    <CTRL L>  C 12    Form feed.    Move to top of next page, same column.
  868. XCR    <CTRL M>  D 13    Carriage Return.  Move to left margin on current page.
  869. XSO    <CTRL N>  E 14    Shift out.  Select following chars from secondary font.
  870. XSI    <CTRL O>  F    15    Shift in.  Select following chars from primary font.
  871. XEC    <Esc>    1B 27    Escape.  Beginning of escape sequence.
  872. X
  873. XTwo character escape sequences
  874. X<Esc>9    Clear L/R Margins
  875. X<Esc>=    Half-line feed.  Move down one-half line.
  876. X<Esc>E    Reset printer
  877. X<Esc>Y    Display functions ON
  878. X<Esc>Z    Display Functions OFF
  879. X<Esc>z    Print self test
  880. X
  881. X
  882. XAmpersand
  883. X<Esc>&a#C        Horizontal (Column) position (can have fractional columns)
  884. X    -#    Move left  # columns
  885. X    +#    Move right # columns
  886. X     #    Move to column # 
  887. X<Esc>&a#G        Page side selection (LaserJet IID)
  888. X    0    Next side
  889. X    1    Front side
  890. X    2    Back side
  891. X<Esc>&a#H        Horizontal position in decipoints (1/720")
  892. X    -#    Move left  # decipoints
  893. X    +#    Move right # decipoints
  894. X     #    Move to # decipoints right of left most printable limit
  895. X<Esc>&a#L        Left Margin.  # of columns
  896. X<Esc>&a#M        Right Margin. # of columns
  897. X<Esc>&a#R        Vertical (Row) position in lines (# can be fractional)
  898. X    -#    Move up # lines 
  899. X    +#    Move down # lines
  900. X     #    Move to line # 
  901. X<Esc>&a#V        Vertical position in decipoints (1/720")
  902. X    -#    Move up # decipoints
  903. X    +#    Move down # decipoints
  904. X     #    Move to # decipoints down from top margin
  905. X<Esc>&d@        Disable Underline
  906. X<Esc>&d#D        Underline
  907. X    0    Enable fixed
  908. X    1    Single fixed
  909. X    2    Double fixed
  910. X    3    Single float
  911. X    4    Double float
  912. X<Esc>&f#S        Push/Pop Current Position
  913. X    0    Push (store)
  914. X    1    Pop  (restore)
  915. X<Esc>&f#X        Macro control
  916. X    0    Start macro definition
  917. X    1    Stop macro definition
  918. X    2    Execute macro
  919. X    3    Call macro
  920. X    4    Enable auto macro overlay
  921. X    5    Disable auto macro overlay
  922. X    6    Delete all macros
  923. X    7    Delete all temporary macros
  924. X    8    Delete macro
  925. X    9    Make macro temporary
  926. X    10    Make macro permanent
  927. X<Esc>&f#Y        Macro ID #
  928. X<Esc>&k#E        Enhancement control (DeskJet)
  929. X    0    Line-by-Line ON  (Underlining turns off at end of line)
  930. X    1    Line-by-Line OFF (Default) (Mode Enhancement Control)
  931. X<Esc>&k#F        SI/SO (Shift-In/Shift-Out) control (DeskJet)
  932. X    0    Line-by-Line ON
  933. X    1    Line-by-Line OFF (Default)
  934. X<Esc>&k#G        Line Termination
  935. X    0    CR=CR; LF=LF; FF=FF
  936. X    1    CR=CR+LF; LF=LF; FF=FF
  937. X    2    CR=CR; LF=CR+LF; FF=CR+FF
  938. X    3    CR=CR+LF; LF=CR+LF; FF=CR+FF
  939. X<Esc>&k#H        Horizontal Motion Index (HMI).  # of 1/120" increments
  940. X<Esc>&k#S        Print pitch
  941. X    0    Default (80 chars per line, printer specific)
  942. X    1    Expanded (ThinkJet)
  943. X    2    Compressed (16-21 cpi, printer specific)
  944. X    3    Expanded-Compressed (10-11 cpi, printer specific)
  945. X    4    18 cpi, 144 cpl (PaintJet)
  946. X<Esc>&k#W        Print mode
  947. X    0    Left to right
  948. X    1    Bidirectional
  949. X    2    Right to left
  950. X    3    Transparency (PaintJet)
  951. X    5    Text Scale OFF
  952. X    6    Text Scale ON    (put 66 lines on page) (DeskJet)
  953. X<Esc>&l#A        Paper size
  954. X    0    Default
  955. X    1    Executive
  956. X    2    US-Letter
  957. X    3    US-Legal
  958. X    26    ISO A4
  959. X    80    Monarch Envelope
  960. X    81    COM 10 Envelope
  961. X    90    DL Envelope
  962. X    91    C5 Envelope
  963. X<Esc>&l#C        Vertical Motion Index (VMI).  # of 1/48" increments
  964. X<Esc>&l#D        Lines per inch.  (Valid # = 1,2,3,4,6,8,12,16,24,48)
  965. X<Esc>&l#E        Top Margin.  # of lines
  966. X<Esc>&l#F        Text Length. # of lines
  967. X<Esc>&l#H        Paper Source
  968. X    0    Eject Page
  969. X    1    Default. (LJ=Input Cassette, IIP=MP tray, DJ=tray)
  970. X    2    Manual Feed
  971. X    3    Manual Envelope Feed
  972. X    4    Lower Tray
  973. X    6    Envelope Feeder
  974. X<Esc>&l#L        Perforation Skip
  975. X    0    Disable
  976. X    1    Enable
  977. X<Esc>&l#O        Orientation
  978. X    0    Portrait
  979. X    1    Landscape
  980. X<Esc>&l#P        Page length (5-128)
  981. X<Esc>&l#S        Simplex/Duplex print (LaserJet IID)
  982. X    0    Simplex
  983. X    1    Duplex long-edge binding
  984. X    2    Duplex short-edge binding
  985. X<Esc>&l#T        Job offset control (LaserJet 500+)
  986. X    0    Set stacking position to default
  987. X    1    Toggle stacking position
  988. X<Esc>&l#U        Long edge offset in # of Decipoints (1/720")
  989. X<Esc>&l#X        Number of copies
  990. X<Esc>&l#Z        Short (top) edge offset in # of Decipoints (1/720")
  991. X<Esc>&p#X[Data]    Transparent print data
  992. X<Esc>&s#C        End of line wrap
  993. X    0    Enabled
  994. X    1    Disabled
  995. X<Esc>&v#S        Color Text    (PaintJet)
  996. X    0    Black (default)
  997. X    1    Red
  998. X    2    Green
  999. X    3    Yellow
  1000. X    4    Blue
  1001. X    5    Magenta
  1002. X    6    Cyan
  1003. X    7    White (no text)
  1004. X
  1005. X
  1006. XParentheses ( and )
  1007. X<Esc>(#@
  1008. X    0    Select default symbol set for the primary font in current orientation
  1009. X    1    Select default symbol set for the primary font in current orientation
  1010. X    2    Select current primary symbol set for the primary font
  1011. X    3    Set primary font characteristics to that of the default font.
  1012. X<Esc>(#@
  1013. X    0    Select default symbol set for the secondary font
  1014. X    1    Set secondary symbol set to default primary font
  1015. X    2    Set secondary symbol set to current primary font
  1016. X    3    Set secondary font characteristics to that of the default second font
  1017. X<Esc>(#A
  1018. X    0    Math7
  1019. X<Esc>(#B
  1020. X    0    Line Draw
  1021. X<Esc>(#D
  1022. X    0    ISO 60: Norwegian 1
  1023. X    1    ISO 61: Norwegian 2
  1024. X<Esc>(#E
  1025. X    0    Roman Extension
  1026. X    1    ISO 4: United Kingdom
  1027. X<Esc>(#F
  1028. X    0    ISO 25: French
  1029. X    1    ISO 69: French
  1030. X<Esc>(#G
  1031. X    0    HP German
  1032. X    1    ISO 21: German
  1033. X<Esc>(#I
  1034. X    0    ISO 15: Italian
  1035. X<Esc>(#K
  1036. X    0    ISO 14: JIS ASCII
  1037. X    2    ISO 57: Chinese
  1038. X    8    Kana-8
  1039. X<Esc>(#L
  1040. X    0    Line Draw
  1041. X<Esc>(#M
  1042. X    8    Math8
  1043. X<Esc>(#N
  1044. X    0    ECMA-94: Latin 1
  1045. X<Esc>(#Q
  1046. X    0    Math8a
  1047. X    1    Math8b
  1048. X    2    PI Fonta
  1049. X<Esc>(#S
  1050. X    0    ISO 11: Swedish
  1051. X    1    HP Spanish
  1052. X    2    ISO 17: Spanish
  1053. X    3    ISO 10: Swedish
  1054. X    4    ISO 16: Portuguese
  1055. X    5    ISO 84: Portuguese
  1056. X    6    ISO 85: Spanish
  1057. X<Esc>(#U
  1058. X    0    ISO 6: ASCII
  1059. X    1    Legal
  1060. X    2    ISO 2: IRV
  1061. X    8    HP Roman8
  1062. X    9    ANSI-8
  1063. X    10    PC-8
  1064. X    11    PC-8 (Danish/Norwegian)
  1065. X    12    PC 850
  1066. X    15    PI Font
  1067. X<Esc>(#X        Select font by ID 
  1068. X
  1069. X<Esc>(s#B        Weight
  1070. X    -    Light    (-1 to -7)
  1071. X    0    Medium
  1072. X    +    Bold    (1 to 7)
  1073. X<Esc>(s#H        Characters per inch
  1074. X<Esc>(s#P        Spacing
  1075. X    0    Fixed
  1076. X    1    Proportional
  1077. X<Esc>(s#Q        Quality
  1078. X    0    Draft
  1079. X    1    Draft
  1080. X    2    Letter
  1081. X<Esc>(s#S        Style
  1082. X    0    Upright
  1083. X    1    Italic
  1084. X<Esc>(s#T        Typeface
  1085. X    0    LinePrinter
  1086. X    1    Pica
  1087. X    2    Elite
  1088. X    3    Courier
  1089. X    4    Helv
  1090. X    5    Tms Rmn
  1091. X    6    Gothic
  1092. X    7    Script
  1093. X    8    Prestige Elite
  1094. X    9    Caslon
  1095. X    10    Orator
  1096. X    11    Presentations
  1097. X    17    Optima
  1098. X    18    ITC Garamond
  1099. X    19    Cooper Black
  1100. X    20    Coronet Bold
  1101. X    21    Broadway
  1102. X    22    Bauer Bodoni Black Condensed
  1103. X    23    Century Schoolbook
  1104. X    24    University Roman
  1105. X    85    Univers Condensed
  1106. X<Esc>(s#U        Placement (DeskJet)
  1107. X    -1    Begin subscripts
  1108. X    0    Normal
  1109. X    +1    Begin superscripts
  1110. X<Esc>(s#V        Point size.  # 1/72"
  1111. X<Esc>(s#W[Data] Font descriptor (font header)
  1112. X<Esc>)s#W[Data]    Download character
  1113. X
  1114. X
  1115. XAsterisk
  1116. X<Esc>*b#M        Set Compression Mode
  1117. X    0    Unencoded
  1118. X    1    Run-length encoding
  1119. X    2    Tagged Image File Format (TIFF) rev. 4.0
  1120. X<Esc>*b#V[Data]    Transfer One Plane of Raster Data
  1121. X<Esc>*b#W[Data]    Transfer Raster Data
  1122. X<Esc>*b#X        Define horizontal offset in pixels (0 to 32767)
  1123. X<Esc>*b#Y        Define vertical offset in pixels (-5 to 32767)
  1124. X
  1125. X
  1126. X<Esc>*c#A        Horizontal rectangle size in dots (1/300 inch)
  1127. X<Esc>*c#B        Vertical rectangle size in dots (1/300 inch)
  1128. X<Esc>*c#D        Specify Font ID (0 to 32767)
  1129. X<Esc>*c#E        Specify character code (0 to 255)
  1130. X<Esc>*c#F        Font and character control
  1131. X    0    Delete all soft fonts
  1132. X    1    Delete all temporary soft fonts
  1133. X    2    Delete soft font (last ID specified)
  1134. X    3    Delete character code (last ID and character code)
  1135. X    4    Make soft font temporary (last font ID specified)
  1136. X    5    Make soft font permanent (last font ID specified)
  1137. X    6    Copy/Assign current invoked font as temporary
  1138. X<Esc>*c#G        Area Fill ID (1-100 for shading fill; 1-6 for pattern fill)
  1139. X    Shading breakpoints:  (% fill)
  1140. X    1-2
  1141. X    2-10
  1142. X   10-20
  1143. X   20-35
  1144. X   35-55
  1145. X   55-80
  1146. X   80-99
  1147. X   99-100
  1148. X    Patterns:
  1149. X    1    Horizontal Lines
  1150. X    2    Vertical Lines
  1151. X    3    Diagonal Lines  ///
  1152. X    4    Diagonal Lines  \\\
  1153. X    5    Square Grid
  1154. X    6    Diagonal Grid
  1155. X<Esc>*c#H        Horizontal rectangle size in decipoints (1/720 inch)
  1156. X<Esc>*c#P        Fill Rectangular Area
  1157. X    0    Solid area fill (Black)
  1158. X    1    White fill
  1159. X    2    Shaded fill
  1160. X    3    HP defined pattern fill
  1161. X<Esc>*c#V        Vertical rectangle size in decipoints (1/720 inch)
  1162. X
  1163. X
  1164. X<Esc>*p#X        Horizontal cursor positioning in dots (1/300) inch
  1165. X    -#    Move left  # dots
  1166. X    +#    Move right # dots
  1167. X     #    Move to # dots right of left boundary
  1168. X<Esc>*p#Y        Vertical cursor positioning in dots (1/300) inch
  1169. X    -#    Move up # dots
  1170. X    +#    Move down # dots
  1171. X     #    Move to # dots down from top margin
  1172. X
  1173. X<Esc>*r#A        Start raster graphics
  1174. X    0    Graphics should be started at the left-most printable position
  1175. X    1    Set starting position and left graphics margin to current position
  1176. X<Esc>*rB        End raster graphics
  1177. X<Esc>*r#F        Raster graphics presentation mode
  1178. X    0    Image printed in orientation of logical page (rotate image)
  1179. X    3    Image printed along the width of physical page (Landscape compatible)
  1180. X<Esc>*rK        Return Model Number
  1181. X<Esc>*r#Q        Graphics quality
  1182. X    0    Set to default (high)
  1183. X    1    Set to draft
  1184. X    2    Set to high
  1185. X<Esc>*r#S        Define image width in pixels per row (0 to 32767)
  1186. X    640    Thinkjet low density graphics
  1187. X    720    Paintjet low density graphics
  1188. X   1280    Thinkjet high density graphics
  1189. X   1440 Paintjet high density graphics
  1190. X<Esc>*r#U        Set number of color planes per row (1 to 4) (PaintJet)
  1191. X
  1192. X<Esc>*t#R        Set resolution (dots per inch)
  1193. X    LaserJet/DeskJet    75, 100, 150 and 300
  1194. X    PaintJet            90, 180
  1195. X
  1196. X<Esc>*v#A        Set red (4 to 90)   (PaintJet)
  1197. X<Esc>*v#B        Set green (4 to 88) (PaintJet)
  1198. X<Esc>*v#C        Set blue (6 to 85)  (PaintJet)
  1199. X<Esc>*v#I        Put color given by <Esc>*v#A/B/C into color 
  1200. X                palette at index #  (PaintJet)
  1201. END_OF_FILE
  1202. if test 8877 -ne `wc -c <'chart'`; then
  1203.     echo shar: \"'chart'\" unpacked with wrong size!
  1204. fi
  1205. # end of 'chart'
  1206. fi
  1207. if test -f 'externals.c' -a "${1}" != "-c" ; then 
  1208.   echo shar: Will not clobber existing file \"'externals.c'\"
  1209. else
  1210. echo shar: Extracting \"'externals.c'\" \(672 characters\)
  1211. sed "s/^X//" >'externals.c' <<'END_OF_FILE'
  1212. X/* $RCSfile: externals.c,v $  $Revision: 2.0 $ */
  1213. X
  1214. X#define extern
  1215. X#define EXTERN_H
  1216. X#include "externals.h"
  1217. X
  1218. Xchar    primary[] = "primary";
  1219. Xchar    secondary[] = "secondary"; 
  1220. Xchar    bad_esc[] = "WARNING!!!  Improper/unknown escape sequence.\n";
  1221. Xchar    questions[] = "???\n";
  1222. Xchar    out_of_range[] = "WARNING!!!  %d is out of range.\n";
  1223. Xchar *err_msg[]=
  1224. X{
  1225. X"Everything ok.\n",
  1226. X"\nCommand format:  pcl2english [options] infile [outfile]\n\n\
  1227. X   Translate PCL escape sequences to English.\n\n\
  1228. X   options:\n\
  1229. X   -e  print escape sequences only\n\
  1230. X   -v  print version number\n\
  1231. X   -x  print hexadecimal equivalent\n\n",
  1232. X"Input file does not exist\n\n",
  1233. X"Unable to open output file\n\n"
  1234. X};
  1235. END_OF_FILE
  1236. if test 672 -ne `wc -c <'externals.c'`; then
  1237.     echo shar: \"'externals.c'\" unpacked with wrong size!
  1238. fi
  1239. # end of 'externals.c'
  1240. fi
  1241. if test -f 'externals.h' -a "${1}" != "-c" ; then 
  1242.   echo shar: Will not clobber existing file \"'externals.h'\"
  1243. else
  1244. echo shar: Extracting \"'externals.h'\" \(799 characters\)
  1245. sed "s/^X//" >'externals.h' <<'END_OF_FILE'
  1246. X/* $RCSfile: externals.h,v $  $Revision: 2.0 $ */
  1247. X#define CHAR_START_LEN    10
  1248. X#define CHAR_END_LEN    10
  1249. X
  1250. Xextern char        esc_string[255];
  1251. Xextern char        raster_header[20];
  1252. Xextern char        char_start[CHAR_START_LEN + CHAR_END_LEN];
  1253. Xextern char        char_end[CHAR_END_LEN];
  1254. Xextern char        fraction[20];
  1255. Xextern int        mode;
  1256. Xextern int        raster_mode;
  1257. Xextern int        raster_count;
  1258. Xextern int        char_count;
  1259. Xextern int        esc_count;
  1260. Xextern int        first_col;
  1261. Xextern int        last_col;
  1262. Xextern int        current_col;
  1263. Xextern int        num_lines;
  1264. Xextern int        num;
  1265. Xextern int        plus;
  1266. Xextern int        minus;
  1267. Xextern int        is_float;
  1268. Xextern int        opt_e;
  1269. Xextern int        opt_v;
  1270. Xextern int        opt_x;
  1271. X
  1272. X#ifndef EXTERN_H
  1273. Xextern char    primary[];
  1274. Xextern char    secondary[];
  1275. Xextern char    bad_esc[];
  1276. Xextern char    questions[];
  1277. Xextern char    out_of_range[];
  1278. Xextern char *err_msg[];
  1279. X#endif
  1280. X
  1281. END_OF_FILE
  1282. if test 799 -ne `wc -c <'externals.h'`; then
  1283.     echo shar: \"'externals.h'\" unpacked with wrong size!
  1284. fi
  1285. # end of 'externals.h'
  1286. fi
  1287. if test -f 'gdefs.h' -a "${1}" != "-c" ; then 
  1288.   echo shar: Will not clobber existing file \"'gdefs.h'\"
  1289. else
  1290. echo shar: Extracting \"'gdefs.h'\" \(318 characters\)
  1291. sed "s/^X//" >'gdefs.h' <<'END_OF_FILE'
  1292. X/* $RCSfile: gdefs.h,v $  $Revision: 2.0 $ */
  1293. X
  1294. X#define TRUE            1
  1295. X#define FALSE            0
  1296. X
  1297. X#define NO_RASTER        0
  1298. X#define V_RASTER        1
  1299. X#define W_RASTER        2
  1300. X
  1301. X#define BACK_SPACE         8
  1302. X#define TAB                 9
  1303. X#define LINE_FEED        10
  1304. X#define FORM_FEED        12
  1305. X#define CARRIAGE_RETURN    13
  1306. X#define SHIFT_OUT        14
  1307. X#define SHIFT_IN        15
  1308. X#define ESC                27
  1309. END_OF_FILE
  1310. if test 318 -ne `wc -c <'gdefs.h'`; then
  1311.     echo shar: \"'gdefs.h'\" unpacked with wrong size!
  1312. fi
  1313. # end of 'gdefs.h'
  1314. fi
  1315. if test -f 'getopt.c' -a "${1}" != "-c" ; then 
  1316.   echo shar: Will not clobber existing file \"'getopt.c'\"
  1317. else
  1318. echo shar: Extracting \"'getopt.c'\" \(3795 characters\)
  1319. sed "s/^X//" >'getopt.c' <<'END_OF_FILE'
  1320. X/* $RCSfile: getopt.c,v $  $Revision: 2.0 $ */
  1321. X
  1322. X/* 
  1323. XThis file originally appeared with "GNU diff" v1.10 and obtained from
  1324. Xthe Fred Fish Amiga Library Disk #281.
  1325. X
  1326. XFollowing modifications were made to allow it to compile using prototypes:
  1327. X    #include statements added.
  1328. X    NULL definition as 0 deleted.
  1329. X    strlen and write declarations in ERR deleted.
  1330. X    arguments to getopt put in prototype form.
  1331. X    strcmp results now compared to 0 instead of NULL.
  1332. X
  1333. XAllen Norskog
  1334. X
  1335. X*/
  1336. X
  1337. X/*
  1338. X * From std-unix@ut-sally.UUCP (Moderator, John Quarterman) Sun Nov  3 14:34:15 1985
  1339. X * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET
  1340. X * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP
  1341. X * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix
  1342. X * From: std-unix@ut-sally.UUCP (Moderator, John Quarterman)
  1343. X * Newsgroups: mod.std.unix
  1344. X * Subject: public domain AT&T getopt source
  1345. X * Message-ID: <3352@ut-sally.UUCP>
  1346. X * Date: 3 Nov 85 19:34:15 GMT
  1347. X * Date-Received: 4 Nov 85 12:25:09 GMT
  1348. X * Organization: IEEE/P1003 Portable Operating System Environment Committee
  1349. X * Lines: 91
  1350. X * Approved: jsq@ut-sally.UUCP
  1351. X * 
  1352. X * Here's something you've all been waiting for:  the AT&T public domain
  1353. X * source for getopt(3).  It is the code which was given out at the 1985
  1354. X * UNIFORUM conference in Dallas.  I obtained it by electronic mail
  1355. X * directly from AT&T.  The people there assure me that it is indeed
  1356. X * in the public domain.
  1357. X * 
  1358. X * There is no manual page.  That is because the one they gave out at
  1359. X * UNIFORUM was slightly different from the current System V Release 2
  1360. X * manual page.  The difference apparently involved a note about the
  1361. X * famous rules 5 and 6, recommending using white space between an option
  1362. X * and its first argument, and not grouping options that have arguments.
  1363. X * Getopt itself is currently lenient about both of these things White
  1364. X * space is allowed, but not mandatory, and the last option in a group can
  1365. X * have an argument.  That particular version of the man page evidently
  1366. X * has no official existence, and my source at AT&T did not send a copy.
  1367. X * The current SVR2 man page reflects the actual behavor of this getopt.
  1368. X * However, I am not about to post a copy of anything licensed by AT&T.
  1369. X * 
  1370. X * I will submit this source to Berkeley as a bug fix.
  1371. X * 
  1372. X * I, personally, make no claims or guarantees of any kind about the
  1373. X * following source.  I did compile it to get some confidence that
  1374. X * it arrived whole, but beyond that you're on your own.
  1375. X * 
  1376. X */
  1377. X
  1378. X
  1379. X/*LINTLIBRARY*/
  1380. X#include <fcntl.h>
  1381. X#include <string.h>
  1382. X
  1383. X#ifndef EOF
  1384. X#define EOF    (-1)
  1385. X#endif
  1386. X
  1387. X#define ERR(s, c)    if(opterr){\
  1388. X    char errbuf[2];\
  1389. X    errbuf[0] = c; errbuf[1] = '\n';\
  1390. X    (void) write(2, argv[0], (unsigned)strlen(argv[0]));\
  1391. X    (void) write(2, s, (unsigned)strlen(s));\
  1392. X    (void) write(2, errbuf, (unsigned)2);}
  1393. X
  1394. Xint    opterr = 1;
  1395. Xint    optind = 1;
  1396. Xint    optopt;
  1397. Xchar    *optarg;
  1398. X
  1399. Xint getopt(int argc, char **argv, char *opts)
  1400. X{
  1401. X    static int sp = 1;
  1402. X    register int c;
  1403. X    register char *cp;
  1404. X
  1405. X    if(sp == 1)
  1406. X        if(optind >= argc ||
  1407. X           argv[optind][0] != '-' || argv[optind][1] == '\0')
  1408. X            return(EOF);
  1409. X        else if(strcmp(argv[optind], "--") == 0) {
  1410. X            optind++;
  1411. X            return(EOF);
  1412. X        }
  1413. X    optopt = c = argv[optind][sp];
  1414. X    if(c == ':' || (cp=strchr(opts, c)) == 0) {
  1415. X        ERR(" illegal option: ", c);
  1416. X        if(argv[optind][++sp] == '\0') {
  1417. X            optind++;
  1418. X            sp = 1;
  1419. X        }
  1420. X        return('?');
  1421. X    }
  1422. X    if(*++cp == ':') {
  1423. X        if(argv[optind][sp+1] != '\0' && argv[optind][sp+1] != '-')
  1424. X            optarg = &argv[optind++][sp+1];
  1425. X        else if(++optind >= argc || argv[optind][0] == '-') {
  1426. X            ERR(" option requires an argument: ", c);
  1427. X            sp = 1;
  1428. X            return('?');
  1429. X        } else
  1430. X            optarg = argv[optind++];
  1431. X        sp = 1;
  1432. X    } else {
  1433. X        if(argv[optind][++sp] == '\0') {
  1434. X            sp = 1;
  1435. X            optind++;
  1436. X        }
  1437. X        optarg = NULL;
  1438. X    }
  1439. X    return(c);
  1440. X}
  1441. END_OF_FILE
  1442. if test 3795 -ne `wc -c <'getopt.c'`; then
  1443.     echo shar: \"'getopt.c'\" unpacked with wrong size!
  1444. fi
  1445. # end of 'getopt.c'
  1446. fi
  1447. if test -f 'main.c' -a "${1}" != "-c" ; then 
  1448.   echo shar: Will not clobber existing file \"'main.c'\"
  1449. else
  1450. echo shar: Extracting \"'main.c'\" \(4820 characters\)
  1451. sed "s/^X//" >'main.c' <<'END_OF_FILE'
  1452. X/* $RCSfile: main.c,v $  $Revision: 2.0 $ */
  1453. X
  1454. X/*  
  1455. X
  1456. XProgram: pcl2english
  1457. X
  1458. XAuthor: Allen Norskog
  1459. X
  1460. XRevision history:
  1461. X    V1.x:           - (unreleased development versions)
  1462. X    V2.0:   9/16/90 - First release 
  1463. X
  1464. XThis program released into the Public Domain.
  1465. X
  1466. X*/
  1467. X
  1468. X#include <stdio.h>
  1469. X#include <string.h>
  1470. X#include "gdefs.h"
  1471. X#include "externals.h"
  1472. X#include "protos.h"
  1473. XFILE *fopen(),*ifile,*ofile;
  1474. X
  1475. X#define ERR_USAGE        1
  1476. X#define ERR_INFILE        2
  1477. X#define ERR_OUTFILE        3
  1478. X
  1479. X#define MODE_CHAR        0
  1480. X#define MODE_ESC        1
  1481. X
  1482. Xextern int optind;
  1483. Xstatic char version[]="\npcl2english V2.0\n";
  1484. X
  1485. Xvoid init(void)
  1486. X{
  1487. X    opt_e = FALSE;
  1488. X    opt_v = FALSE;
  1489. X    opt_x = FALSE;
  1490. X    first_col = current_col = 0;
  1491. X    last_col = 79;
  1492. X    num_lines = 0;
  1493. X    raster_mode = NO_RASTER;
  1494. X    raster_count = 0;
  1495. X}
  1496. X
  1497. Xvoid main(int argc, char *argv[])
  1498. X{
  1499. X    int c;
  1500. X    int done;
  1501. X
  1502. X
  1503. X    init();
  1504. X    /* Decode the options.  */
  1505. X
  1506. X    while ((c = getopt (argc, argv, "evx")) != EOF) {
  1507. X        switch (c) {
  1508. X            case 'e':
  1509. X                /* Print escape sequences only.  */
  1510. X                opt_e = TRUE;
  1511. X                break;
  1512. X            case 'v':
  1513. X                /* Print version number.  */
  1514. X                opt_v = TRUE;
  1515. X                break;
  1516. X            case 'x':
  1517. X                /* Print hexadecimal equivalents.  */
  1518. X                opt_x = TRUE;
  1519. X                break;
  1520. X            case '?':
  1521. X                /* Illegal option -- print usage message */
  1522. X                err_exit(ERR_USAGE);
  1523. X                break;
  1524. X        }
  1525. X    }
  1526. X    if (optind > argc - 1) {
  1527. X        if (opt_v) {
  1528. X            printf("%s\n\n",version);
  1529. X            exit(0);
  1530. X        }
  1531. X        else {
  1532. X            err_exit(ERR_USAGE);
  1533. X        }
  1534. X    }
  1535. X    ifile=fopen(argv[optind],"r");
  1536. X    if (!ifile) {
  1537. X        err_exit(ERR_INFILE);
  1538. X    }
  1539. X    if (optind <= argc - 2) {
  1540. X        ofile=fopen(argv[optind + 1],"w");
  1541. X        if (!ofile) {
  1542. X            err_exit(ERR_OUTFILE);
  1543. X        }
  1544. X    }
  1545. X    else ofile=stdout;
  1546. X    if (opt_v) {
  1547. X        fprintf(ofile, "%s\n\n",version);
  1548. X    }
  1549. X    mode = MODE_CHAR;
  1550. X    done = FALSE;
  1551. X    while (done == FALSE) {
  1552. X        c = getc(ifile);
  1553. X        if (c == EOF) {
  1554. X            done = TRUE;
  1555. X        }
  1556. X        switch (mode) {
  1557. X            case MODE_CHAR:
  1558. X                switch (c) {
  1559. X                    case ESC:
  1560. X                        if (char_count > 0) {
  1561. X                            print_chars();  
  1562. X                            /* print_chars will make sure raster_mode 
  1563. X                               is cleared */
  1564. X                        }
  1565. X                        else {
  1566. X                        }
  1567. X                        mode = MODE_ESC;
  1568. X                        esc_count = 0;
  1569. X                        esc_string[esc_count] = c;
  1570. X                        break;
  1571. X                    case FORM_FEED:
  1572. X                        print_chars();
  1573. X                        fprintf(ofile,
  1574. X                            "\n<Form feed>  Move to first line at top of next page\n");
  1575. X                        if (opt_x) {
  1576. X                            fprintf(ofile,"0C");
  1577. X                        }
  1578. X                        else {
  1579. X                            fprintf(ofile,"  ");
  1580. X                        }
  1581. X                        fprintf(ofile,
  1582. X                            "           while maintaining current column ");
  1583. X                        fprintf(ofile,"at %d.\n", current_col);
  1584. X                        break;
  1585. X                    case SHIFT_IN:
  1586. X                        print_chars();
  1587. X                        fprintf(ofile,
  1588. X                            "\n<Shift In>  Select characters that follow from the\n");
  1589. X                        if (opt_x) {
  1590. X                            fprintf(ofile,"0F");
  1591. X                        }
  1592. X                        else {
  1593. X                            fprintf(ofile,"  ");
  1594. X                        }
  1595. X                        fprintf(ofile,"          current primary font.\n");
  1596. X                        break;
  1597. X                    case SHIFT_OUT:
  1598. X                        print_chars();
  1599. X                        fprintf(ofile,
  1600. X                            "\n<Shift Out> Select characters that follow from the\n");
  1601. X                        if (opt_x) {
  1602. X                            fprintf(ofile,"0E");
  1603. X                        }
  1604. X                        else {
  1605. X                            fprintf(ofile,"  ");
  1606. X                        }
  1607. X                        fprintf(ofile,"          current secondary font.\n");
  1608. X                        break;
  1609. X                    case EOF:
  1610. X                        print_chars();
  1611. X                        fprintf(ofile,"\n");
  1612. X                        break;
  1613. X                    case CARRIAGE_RETURN:
  1614. X                        current_col = first_col;
  1615. X                        add_char(c);
  1616. X                        break;
  1617. X                    case LINE_FEED:
  1618. X                        num_lines++;
  1619. X                        add_char(c);
  1620. X                        break;
  1621. X                    case BACK_SPACE:
  1622. X                        if (current_col > first_col) {
  1623. X                            current_col--;
  1624. X                        }
  1625. X                        add_char(c);
  1626. X                        break;
  1627. X                    case TAB:
  1628. X                        {
  1629. X                            int i;
  1630. X                            i = (current_col - first_col) / 8;
  1631. X                            current_col = (i+1)*8 + first_col;
  1632. X                            if (current_col > last_col) {
  1633. X                                current_col = last_col;
  1634. X                            }
  1635. X                            add_char(c);
  1636. X                        }
  1637. X                        break;
  1638. X                    default:
  1639. X                        add_char(c);
  1640. X                        if (((c >= 32) && (c <= 127)) ||
  1641. X                            ((c >= 161) && (c <= 254))) {
  1642. X                            /* Ignore non-printing characters in
  1643. X                                Roman-8 character set */
  1644. X                            if (current_col < last_col) {
  1645. X                                current_col++;
  1646. X                            }
  1647. X                        }
  1648. X                        break;
  1649. X                }
  1650. X                break;
  1651. X            case MODE_ESC:
  1652. X                if (c == EOF) {
  1653. X                    fprintf(ofile,
  1654. X                        "\nEOF reached before completing last escape sequence.\n");
  1655. X                }
  1656. X                else {
  1657. X                    esc_count++;
  1658. X                    esc_string[esc_count] = c;
  1659. X                    if (((esc_count == 1) && (c >= '0') && (c <= '~')) ||
  1660. X                        /* A two character escape string */
  1661. X                        ((c >= '@') && (c <= 'Z'))) {    
  1662. X                        /* Look for terminating character.
  1663. X                            @ is just before A */
  1664. X
  1665. X                            esc_string[esc_count + 1] = 0;
  1666. X                        if (raster_mode == NO_RASTER) {
  1667. X                            print_esc_string();
  1668. X                        }
  1669. X                        else {
  1670. X                            if (strncmp(esc_string, raster_header, 
  1671. X                                strlen(raster_header)) != 0) {
  1672. X
  1673. X                                print_extra_rasters();
  1674. X                                raster_mode = NO_RASTER;
  1675. X                                print_esc_string();
  1676. X                            }
  1677. X                        }
  1678. X                        decode_esc_string();
  1679. X                        mode = MODE_CHAR;
  1680. X                        char_count = 0;
  1681. X                    }
  1682. X                }
  1683. X                break;
  1684. X            default:
  1685. X                break;
  1686. X        }
  1687. X    }
  1688. X    fclose(ifile);
  1689. X    fclose(ofile);
  1690. X    exit(0);
  1691. X}
  1692. END_OF_FILE
  1693. if test 4820 -ne `wc -c <'main.c'`; then
  1694.     echo shar: \"'main.c'\" unpacked with wrong size!
  1695. fi
  1696. # end of 'main.c'
  1697. fi
  1698. if test -f 'makefile' -a "${1}" != "-c" ; then 
  1699.   echo shar: Will not clobber existing file \"'makefile'\"
  1700. else
  1701. echo shar: Extracting \"'makefile'\" \(1141 characters\)
  1702. sed "s/^X//" >'makefile' <<'END_OF_FILE'
  1703. X#  $RCSfile: makefile,v $ $Revision: 2.0 $  $Date: 90/09/16 20:27:28 $ 
  1704. X#
  1705. X# CFLAGS ---    -bs = Sdb debug option
  1706. X#                -a = Don't Start Assembler
  1707. X#                -at = Don't Start Assembler & imbed C source as comments
  1708. X#                -qf = Enable QuikFix
  1709. X#                -sf = Fast for loops (don't use with cdb)
  1710. X#                -sn = Avoid link/unlk (don't use with cdb)
  1711. X#                -sp = Delay stack ops until necessary
  1712. X#                -sr = Let compiler pick register variables.
  1713. X#                -ss = Allow duplicate strings.
  1714. X#                -so = -sa -sf -sm -sn -sp -sr -ss
  1715. X#                -wa = Warn about casting.
  1716. X#                -wr = Warn about bad return value.
  1717. X#                -wu = Warn about unused variables.
  1718. X#                -wl = Warn about lots of stuff. ( -wa, -wr, -wu)
  1719. X#                -wd = Warn if old pre-ansi function def used.
  1720. X#                -wp = Warn if prototype not given.
  1721. X# LFLAGS ---    -g = generate sdb output file
  1722. X
  1723. XCFLAGS-G = -bs -qf -sp -sr -ss -wr -wu -wd -wp -wa
  1724. XLFLAGS-G = -g
  1725. X
  1726. XCFLAGS-O = -so -qf -wl -wp
  1727. XLFLAGS-O = 
  1728. X
  1729. XCFLAGS = $(CFLAGS-O)
  1730. XLFLAGS = $(LFLAGS-O)
  1731. X
  1732. XOBJECTS = amp.o asterisk.o externals.o main.o paren.o utils.o getopt.o
  1733. X
  1734. X.c.o:
  1735. X    cc $(CFLAGS) -o $@ $*.c
  1736. X
  1737. X.c.s:
  1738. X    cc $(CFLAGS) -at -o $@ $*.c
  1739. X
  1740. Xpcl2english:    $(OBJECTS)
  1741. X    ln $(LFLAGS) $(OBJECTS) -o $* -lc
  1742. X
  1743. END_OF_FILE
  1744. if test 1141 -ne `wc -c <'makefile'`; then
  1745.     echo shar: \"'makefile'\" unpacked with wrong size!
  1746. fi
  1747. # end of 'makefile'
  1748. fi
  1749. if test -f 'paren.c' -a "${1}" != "-c" ; then 
  1750.   echo shar: Will not clobber existing file \"'paren.c'\"
  1751. else
  1752. echo shar: Extracting \"'paren.c'\" \(9041 characters\)
  1753. sed "s/^X//" >'paren.c' <<'END_OF_FILE'
  1754. X/* $RCSfile: paren.c,v $  $Revision: 2.0 $ */
  1755. X
  1756. X#include <stdio.h>
  1757. X#include "gdefs.h"
  1758. X#include "externals.h"
  1759. X#include "protos.h"
  1760. X
  1761. Xextern FILE *ifile,*ofile;
  1762. X
  1763. Xstatic char *type_faces[] = {
  1764. X    "LinePrinter",
  1765. X    "Pica",
  1766. X    "Elite",
  1767. X    "Courier",
  1768. X    "Helv",
  1769. X    "Tms Rmn",
  1770. X    "Gothic",
  1771. X    "Script",
  1772. X    "Prestige Elite",
  1773. X    "Caslon",
  1774. X    "Orator",
  1775. X    "Presentations",
  1776. X    "???",
  1777. X    "???",
  1778. X    "???",
  1779. X    "???",
  1780. X    "???",
  1781. X    "Optima",
  1782. X    "ITC Garamond",
  1783. X    "Cooper Black",
  1784. X    "Coronet Bold",
  1785. X    "Broadway",
  1786. X    "Bauer Bodoni Black Condensed",
  1787. X    "Century Schoolbook",
  1788. X    "University Roman",
  1789. X};
  1790. X
  1791. Xstatic char *spacings[] = {
  1792. X    "Fixed",
  1793. X    "Proportional",
  1794. X};
  1795. X
  1796. Xstatic char *quality[] = {
  1797. X    "Draft",
  1798. X    "Draft",
  1799. X    "Letter",
  1800. X};
  1801. X
  1802. Xstatic char *placement[] = {
  1803. X    "Begin subscripts",
  1804. X    "Resume normal printing",
  1805. X    "Begin superscripts",
  1806. X};
  1807. X
  1808. Xstatic char *styles[] = {
  1809. X    "Upright",
  1810. X    "Italics",
  1811. X};
  1812. X
  1813. X#define MAX_SET_AT    3
  1814. Xstatic char *symbol_set_at[MAX_SET_AT + 1] = {
  1815. X    "printer default",
  1816. X    "primary default",
  1817. X    "current primary",
  1818. X    "default",
  1819. X};
  1820. X
  1821. X#define MAX_SET_A    0
  1822. Xstatic char *symbol_set_a[MAX_SET_A + 1] = {
  1823. X    "Math Symbols",
  1824. X};
  1825. X
  1826. X#define MAX_SET_B    0
  1827. Xstatic char *symbol_set_b[MAX_SET_B + 1] = {
  1828. X    "Line Draw",
  1829. X};
  1830. X
  1831. X#define MAX_SET_D    1
  1832. Xstatic char *symbol_set_d[MAX_SET_D + 1] = {
  1833. X    "ISO 60: Norwegian 1",
  1834. X    "ISO 61: Norwegian 2",
  1835. X};
  1836. X
  1837. X#define MAX_SET_E    1
  1838. Xstatic char *symbol_set_e[MAX_SET_E + 1] = {
  1839. X    "Roman Extension",
  1840. X    "ISO 4: United Kingdom",
  1841. X};
  1842. X
  1843. X#define MAX_SET_F    1
  1844. Xstatic char *symbol_set_f[MAX_SET_F + 1] = {
  1845. X    "ISO 25: French",
  1846. X    "ISO 69: French",
  1847. X};
  1848. X
  1849. X#define MAX_SET_G    1
  1850. Xstatic char *symbol_set_g[MAX_SET_G + 1] = {
  1851. X    "HP German",
  1852. X    "ISO 21: German",
  1853. X};
  1854. X
  1855. X#define MAX_SET_I    0
  1856. Xstatic char *symbol_set_i[MAX_SET_I + 1] = {
  1857. X    "ISO 15: Italian",
  1858. X};
  1859. X
  1860. X#define MAX_SET_K    8
  1861. Xstatic char *symbol_set_k[MAX_SET_K + 1] = {
  1862. X    "ISO 14: JIS ASCII",
  1863. X    "",
  1864. X    "ISO 57: Chinese",
  1865. X    "",
  1866. X    "",
  1867. X    "",
  1868. X    "",
  1869. X    "",
  1870. X    "Kana-8",
  1871. X};
  1872. X
  1873. X#define MAX_SET_L    0
  1874. Xstatic char *symbol_set_l[MAX_SET_L + 1] = {
  1875. X    "Line Draw",
  1876. X};
  1877. X
  1878. X
  1879. X#define MAX_SET_M    8
  1880. Xstatic char *symbol_set_m[MAX_SET_M + 1] = {
  1881. X    "",
  1882. X    "",
  1883. X    "",
  1884. X    "",
  1885. X    "",
  1886. X    "",
  1887. X    "",
  1888. X    "",
  1889. X    "Math8",
  1890. X};
  1891. X
  1892. X#define MAX_SET_N    0
  1893. Xstatic char *symbol_set_n[MAX_SET_N + 1] = {
  1894. X    "ECMA-94: Latin 1",
  1895. X};
  1896. X
  1897. X#define MAX_SET_Q    2
  1898. Xstatic char *symbol_set_q[MAX_SET_Q + 1] = {
  1899. X    "Math8a",
  1900. X    "Math8b",
  1901. X    "PI Fonta",
  1902. X};
  1903. X
  1904. X#define MAX_SET_S    6
  1905. Xstatic char *symbol_set_s[MAX_SET_S + 1] = {
  1906. X    "ISO 11: Swedish",
  1907. X    "HP Spanish",
  1908. X    "ISO 17: Spanish",
  1909. X    "ISO 10: Swedish",
  1910. X    "ISO 16: Portuguese",
  1911. X    "ISO 84: Portuguese",
  1912. X    "ISO 85: Spanish",
  1913. X};
  1914. X
  1915. X#define MAX_SET_U    15
  1916. Xstatic char *symbol_set_u[MAX_SET_U + 1] = {
  1917. X    "ISO 6: ASCII",
  1918. X    "Legal",
  1919. X    "ISO 2: IRV",
  1920. X    "",
  1921. X    "",
  1922. X    "",
  1923. X    "",
  1924. X    "",
  1925. X    "HP Roman8",
  1926. X    "ANSI-8",
  1927. X    "PC-8",
  1928. X    "PC-8 (Danish/Norwegian)",
  1929. X    "PC 850",
  1930. X    "",
  1931. X    "",
  1932. X    "PI Font",
  1933. X};
  1934. X
  1935. Xvoid decode_paren(void)    /* <Esc>(  or  <Esc>) */
  1936. X{
  1937. X    int         start_pos;
  1938. X    int         stop_pos;
  1939. X    int         i;
  1940. X    int         max;
  1941. X    int         done;
  1942. X    int         starting_val;
  1943. X    char     c1,c2,c3;
  1944. X    char    *font;
  1945. X    char    **pp_char;
  1946. X
  1947. X    c1 = esc_string[1];
  1948. X    c2 = esc_string[2];
  1949. X    c3 = esc_string[3];
  1950. X    font = primary;
  1951. X    if (c1 == ')') {
  1952. X        font = secondary;
  1953. X    }
  1954. X    if ((c2 >= '0') && (c2 <= '9')) {
  1955. X        /* The font selection sequences seem to vary from the standard
  1956. X           pcl practice of following the escape with 2 characters then
  1957. X           a number.  
  1958. X           All the pcl font selection examples do not try to combine
  1959. X           any of this group of escape sequences.  Good software should
  1960. X           try to avoid the confusion of combining these sequences
  1961. X           as well.
  1962. X           */
  1963. X
  1964. X        starting_val = c2 - '0';
  1965. X        start_pos = stop_pos = 3;
  1966. X        done = FALSE;
  1967. X        while (done == FALSE) {
  1968. X            get_num(&stop_pos,starting_val);
  1969. X            c3 = esc_string[stop_pos];
  1970. X            print_sub_string(2, start_pos, stop_pos);
  1971. X            if (c3 == '@') {
  1972. X                if ((num >= 0) && (num <= MAX_SET_AT)) {
  1973. X                    fprintf(ofile,"Designate %s font set as %s\n", 
  1974. X                        symbol_set_at[num],font);
  1975. X                    if (num == 3) {
  1976. X                        indent(4);
  1977. X                        fprintf(ofile,
  1978. X                            "Set all font characteristics (except orientation) to\n");
  1979. X                        indent(4);
  1980. X                        fprintf(ofile,
  1981. X                            "those of the default %s font.\n", font);
  1982. X                    }
  1983. X                }
  1984. X                else {
  1985. X                    fprintf(ofile,"Designate %s font ???\n",  font);
  1986. X                }
  1987. X            }
  1988. X            else if ((c3 == 'x') || (c3 == 'X')) {
  1989. X                fprintf(ofile,"select %s font with ID # = %d\n", font,num);
  1990. X            }
  1991. X            else {
  1992. X                pp_char = NULL;
  1993. X                max = -1;
  1994. X                switch (c3) {
  1995. X                    case 'a':
  1996. X                    case 'A':
  1997. X                        max = MAX_SET_A;
  1998. X                        pp_char = symbol_set_a;
  1999. X                        break;
  2000. X                    case 'b':
  2001. X                    case 'B':
  2002. X                        max = MAX_SET_B;
  2003. X                        pp_char = symbol_set_b;
  2004. X                        break;
  2005. X                    case 'd':
  2006. X                    case 'D':
  2007. X                        max = MAX_SET_D;
  2008. X                        pp_char = symbol_set_d;
  2009. X                        break;
  2010. X                    case 'e':
  2011. X                    case 'E':
  2012. X                        max = MAX_SET_E;
  2013. X                        pp_char = symbol_set_e;
  2014. X                        break;
  2015. X                    case 'f':
  2016. X                    case 'F':
  2017. X                        max = MAX_SET_F;
  2018. X                        pp_char = symbol_set_f;
  2019. X                        break;
  2020. X                    case 'g':
  2021. X                    case 'G':
  2022. X                        max = MAX_SET_G;
  2023. X                        pp_char = symbol_set_g;
  2024. X                        break;
  2025. X                    case 'i':
  2026. X                    case 'I':
  2027. X                        max = MAX_SET_I;
  2028. X                        pp_char = symbol_set_i;
  2029. X                        break;
  2030. X                    case 'k':
  2031. X                    case 'K':
  2032. X                        max = MAX_SET_K;
  2033. X                        pp_char = symbol_set_k;
  2034. X                        break;
  2035. X                    case 'l':
  2036. X                    case 'L':
  2037. X                        max = MAX_SET_L;
  2038. X                        pp_char = symbol_set_l;
  2039. X                        break;
  2040. X                    case 'm':
  2041. X                    case 'M':
  2042. X                        max = MAX_SET_M;
  2043. X                        pp_char = symbol_set_m;
  2044. X                        break;
  2045. X                    case 'n':
  2046. X                    case 'N':
  2047. X                        max = MAX_SET_N;
  2048. X                        pp_char = symbol_set_n;
  2049. X                        break;
  2050. X                    case 'q':
  2051. X                    case 'Q':
  2052. X                        max = MAX_SET_Q;
  2053. X                        pp_char = symbol_set_q;
  2054. X                        break;
  2055. X                    case 's':
  2056. X                    case 'S':
  2057. X                        max = MAX_SET_S;
  2058. X                        pp_char = symbol_set_s;
  2059. X                        break;
  2060. X                    case 'u':
  2061. X                    case 'U':
  2062. X                        max = MAX_SET_U;
  2063. X                        pp_char = symbol_set_u;
  2064. X                        break;
  2065. X                    default:
  2066. X                        break;
  2067. X                }
  2068. X                if (pp_char != NULL) {
  2069. X                    fprintf(ofile,"%s font set = ",font);
  2070. X                    if ((num >= 0) && (num <= max)) {
  2071. X                        if (**(pp_char + num) != 0) {
  2072. X                            fprintf(ofile,"%s\n",*(pp_char + num));
  2073. X                        }
  2074. X                        else {
  2075. X                            fprintf(ofile,questions);
  2076. X                        }
  2077. X                    }
  2078. X                    else {
  2079. X                        fprintf(ofile,questions);
  2080. X                    }
  2081. X                }
  2082. X                else {
  2083. X                    fprintf(ofile,"%s",bad_esc);
  2084. X                }
  2085. X            }
  2086. X            stop_pos++;
  2087. X            start_pos = stop_pos;
  2088. X            if (esc_string[start_pos] == 0) {
  2089. X                done = TRUE;
  2090. X            }
  2091. X        }
  2092. X    }
  2093. X    else if (c2 == 's') {
  2094. X        start_pos = stop_pos = 3;
  2095. X        done = FALSE;
  2096. X        while (done == FALSE) {
  2097. X            get_num(&stop_pos,0);
  2098. X            c3 = esc_string[stop_pos];
  2099. X            print_sub_string(2, start_pos, stop_pos);
  2100. X            switch (c3) {
  2101. X                case 'b':
  2102. X                case 'B':
  2103. X                    fprintf(ofile,"%s font weight = ", font);
  2104. X                    if ((num < -7) || (num > 7)) {
  2105. X                        fprintf(ofile,out_of_range,num);
  2106. X                    }
  2107. X                    else if (num < 0) {
  2108. X                        fprintf(ofile,"Light (%d)\n", num);
  2109. X                    }
  2110. X                    else if (num > 0) {
  2111. X                        fprintf(ofile,"Bold (%d)\n", num);
  2112. X                    }
  2113. X                    else {
  2114. X                        fprintf(ofile,"Medium (%d)\n", num);
  2115. X                    }
  2116. X                    break;
  2117. X                case 'h':
  2118. X                case 'H':
  2119. X                    if (is_float) {
  2120. X                        fprintf(ofile,
  2121. X                            "%s font characters per inch = %d.%s\n",
  2122. X                            font, num, fraction);
  2123. X                    }
  2124. X                    else {
  2125. X                        fprintf(ofile,"%s font characters per inch = %d\n",
  2126. X                            font, num);
  2127. X                    }
  2128. X                    break;
  2129. X                case 'p':
  2130. X                case 'P':    /* Fixed or proportional */
  2131. X                    fprintf(ofile,"%s font spacing = ",font);
  2132. X                    if ((num >= 0) && (num <= 1)) {
  2133. X                        fprintf(ofile,"%s\n",spacings[num]);
  2134. X                    }
  2135. X                    else {
  2136. X                        fprintf(ofile,questions);
  2137. X                    }
  2138. X                    break;
  2139. X                case 'q':
  2140. X                case 'Q':    /* Letter or draft quality */
  2141. X                    if (c1 == '(') {
  2142. X                        fprintf(ofile,"Print quality = ");
  2143. X                        if ((num >= 0) && (num <= 2)) {
  2144. X                            fprintf(ofile,"%s\n",quality[num]);
  2145. X                        }
  2146. X                        else {
  2147. X                            fprintf(ofile,questions);
  2148. X                        }
  2149. X                    }
  2150. X                    else {
  2151. X                        fprintf(ofile,"%s",bad_esc);
  2152. X                    }
  2153. X                    break;
  2154. X                case 's':
  2155. X                case 'S':
  2156. X                    fprintf(ofile,"%s font style = ",font);
  2157. X                    if ((num >= 0) && (num <= 1)) {
  2158. X                        fprintf(ofile,"%s\n",styles[num]);
  2159. X                    }
  2160. X                    else {
  2161. X                        fprintf(ofile,questions);
  2162. X                    }
  2163. X                    break;
  2164. X                case 't':
  2165. X                case 'T':
  2166. X                    fprintf(ofile,"%s font typeface = ",font);
  2167. X                    if ((num >= 0) && (num <= 24)) {
  2168. X                        fprintf(ofile,"%s\n",type_faces[num]);
  2169. X                    }
  2170. X                    else if (num == 85) {
  2171. X                        fprintf(ofile,"%s\n","Univers Condensed");
  2172. X                    }
  2173. X                    else {
  2174. X                        fprintf(ofile,questions);
  2175. X                    }
  2176. X                    break;
  2177. X                case 'u':
  2178. X                case 'U':
  2179. X                    fprintf(ofile,"%s text placement = ",font);
  2180. X                    if ((num >= -1) && (num <= 1)) {
  2181. X                        fprintf(ofile,"%s\n",placement[num+1]);
  2182. X                    }
  2183. X                    else {
  2184. X                        fprintf(ofile,questions);
  2185. X                    }
  2186. X                    break;
  2187. X                case 'v':
  2188. X                case 'V':
  2189. X                    fprintf(ofile,"%s font point size = ",font);
  2190. X                    if (is_float) {
  2191. X                        fprintf(ofile, "%d.%s\n", num, fraction);
  2192. X                    }
  2193. X                    else {
  2194. X                        fprintf(ofile, "%d\n", num);
  2195. X                    }
  2196. X                    break;
  2197. X                case 'W':    /* Can't have 'w' */
  2198. X                    if (c1 == '(') {
  2199. X                        fprintf(ofile,
  2200. X                            "Font Descriptor (font header) in next %d characters\n",
  2201. X                            num);
  2202. X                    }
  2203. X                    else {
  2204. X                        fprintf(ofile,
  2205. X                            "Download character data in next %d characters\n",
  2206. X                            num);
  2207. X                    }
  2208. X                    for (i=0; i<num; i++) {
  2209. X                        c1 = getc(ifile);
  2210. X                    }
  2211. X                    done = TRUE;
  2212. X                    break;
  2213. X                default:
  2214. X                    fprintf(ofile,"%s",bad_esc);
  2215. X                    break;
  2216. X            }
  2217. X            stop_pos++;
  2218. X            start_pos = stop_pos;
  2219. X            if (esc_string[start_pos] == 0) {
  2220. X                done = TRUE;
  2221. X            }
  2222. X        }
  2223. X    }
  2224. X    else {
  2225. X        fprintf(ofile,"%s",bad_esc);
  2226. X    }
  2227. X}
  2228. END_OF_FILE
  2229. if test 9041 -ne `wc -c <'paren.c'`; then
  2230.     echo shar: \"'paren.c'\" unpacked with wrong size!
  2231. fi
  2232. # end of 'paren.c'
  2233. fi
  2234. if test -f 'pcl_good.uu' -a "${1}" != "-c" ; then 
  2235.   echo shar: Will not clobber existing file \"'pcl_good.uu'\"
  2236. else
  2237. echo shar: Extracting \"'pcl_good.uu'\" \(1622 characters\)
  2238. sed "s/^X//" >'pcl_good.uu' <<'END_OF_FILE'
  2239. Xbegin 644 pcl_good
  2240. XM#`X/"ALY"AL]"AM%"AM9"AM:"AMZ"ALF83$U8RTU8RLX8RTN-4,*&R9A9S%GM
  2241. XM,F<P1PH;)F$Q-6@M-6@K.$@*&R9A-FPU,$T*&R9A,35R+35R*SAR+2XU4@H;S
  2242. XM)F$Q-78M-78K.%8*&R9D0`H;)F0P9#%D,F0S9#1$"ALF9G,Q<S!3"ALF9C!X$
  2243. XM,7@R>#-X-'@U>#9X-W@X>#EX,3!8"ALF9C-9"ALF:S!E,44*&R9K,&8Q1@H;T
  2244. XM)FLP9S%G,F<S1PH;)FLQ,$@*&R9K,',Q<S)S,W,T4PH;)FLP=S%W,G<S=S5W%
  2245. XM-E<*&R9L,&$Q83)A,V$R-F$X,&$X,6$Y,&$Y,4$*&R9L,3!#"ALF;#A$"ALFX
  2246. XM;#)E-3!&"ALF;#!H,6@R:#-H-&@V2`H;)FQL,6PP3`H;)FQO,6\P3PH;)FPU2
  2247. XM-5`*&R9L<S%S,G,P4PH;)FQT,70P5`H;)FPW50H;)FPR6`H;)FPW6@H;)G`R(
  2248. XM6&%B"ALF<V,Q8S!#"ALF=C!S,7,R<S-S-',U<S9S-U,*"ALH,$`*&R@Q0`H;"
  2249. XM*#)`"ALH,T`*&RDP0`H;*3%`"ALI,D`*&RDS0`H;*#!!"ALH,$(*&R@P1`H;[
  2250. XM*#%$"ALH,$4*&R@Q10H;*#!&"ALH,48*&R@P1PH;*#%'"ALH,$D*&R@P2PH;E
  2251. XM*#)+"ALH.$L*&R@P3`H;*#A-"ALH,$X*&R@P40H;*#%1"ALH,E$*&R@P4PH;]
  2252. XM*#%3"ALH,E,*&R@S4PH;*#13"ALH-5,*&R@V4PH;*#!5"ALH,54*&R@R50H;N
  2253. XM*#A5"ALH.54*&R@Q,%4*&R@Q,54*&R@Q,E4*&R@Q-54*&R@R6`H;*'-B,V(M?
  2254. XM,V(P0@H;*',Q,$@*&RAS,38N-C9("ALH<W`Q<#!0"ALH<S!Q,7$R40H;*'-S#
  2255. XM,7,P4PH;*',P=#%T,G0S=#1T-70V=#=T.'0Y=#$P=#$Q5`H;*',Q-W0Q.'0QQ
  2256. XM.70R,'0R,70R,G0R,W0R-'0X-50*&RAS+3%U,'4K,54*&RAS,316"ALH<S)73
  2257. XM,3(*&RES,E<Q,@H*&RIB;3%M,FTP30H;*F(R5F%B&RIB,E9A8ALJ8C)686(*<
  2258. XM&RIB,E=A8ALJ8C)786(;*F(R5V%B"ALJ8C$P6`H;*F(M,GDQ,%D*&RIC-3!!>
  2259. XM"ALJ8S4P0@H;*F,R1`H;*F,U,$4*&RIC,&8Q9C)F,V8T9C5F-D8*&RIC,W`QD
  2260. XM9S)G,V<T9S5G-D<*&RIC,G`R9S$P9S$U9S,P9S0U9S<P9SDP9S$P,$<*&RIC2
  2261. XM-3!("ALJ8S!P,7`R<#-0"ALJ8S4P5@H;*G`Q-7@M-7@K.%@*&RIP,35Y+35Y=
  2262. XM*SA9"ALJ<C!A,4$*&RIR0@H;*G(P9C-&"ALJ<DL*&RIR<3%Q,G$P40H;*G(V.
  2263. XM-#!S-S(P<S$R.#!S,30T,%,*&RIR-%4*&RIT-S5R,3`P<C$U,'(S,#!R.3!R3
  2264. XM,3@P4@H;*G8U,$$*&RIV-3!""ALJ=C4P0PH;*G8W20H*5&AI<R!I<R!A('1E6
  2265. X$<W0N"@H;$
  2266. X``
  2267. Xend
  2268. Xsize 1129
  2269. END_OF_FILE
  2270. if test 1622 -ne `wc -c <'pcl_good.uu'`; then
  2271.     echo shar: \"'pcl_good.uu'\" unpacked with wrong size!
  2272. fi
  2273. # end of 'pcl_good.uu'
  2274. fi
  2275. if test -f 'protos.h' -a "${1}" != "-c" ; then 
  2276.   echo shar: Will not clobber existing file \"'protos.h'\"
  2277. else
  2278. echo shar: Extracting \"'protos.h'\" \(564 characters\)
  2279. sed "s/^X//" >'protos.h' <<'END_OF_FILE'
  2280. X/* $RCSfile: protos.h,v $  $Revision: 2.0 $ */
  2281. X
  2282. Xextern void exit(int i);
  2283. X
  2284. Xvoid err_exit(int x);
  2285. X
  2286. Xvoid print_hex(int i);
  2287. X
  2288. Xvoid output_byte(int c);
  2289. X
  2290. Xvoid indent(int x);
  2291. X
  2292. Xvoid print_esc_string(void);
  2293. X
  2294. Xvoid print_sub_string(int header, int start, int stop);
  2295. X
  2296. Xvoid get_num(int *stop_pos, int sum);
  2297. X
  2298. Xvoid decode_paren(void);
  2299. X
  2300. Xvoid decode_ampersand(void);
  2301. X
  2302. Xvoid decode_asterisk(void);
  2303. X
  2304. Xvoid decode_esc_string(void);
  2305. X
  2306. Xvoid add_char(int c);
  2307. X
  2308. Xvoid print_extra_rasters(void);
  2309. X
  2310. Xvoid print_char(char c);
  2311. X
  2312. Xvoid print_chars(void);
  2313. X
  2314. Xint    getopt(int argc, char **argv, char *opts);
  2315. END_OF_FILE
  2316. if test 564 -ne `wc -c <'protos.h'`; then
  2317.     echo shar: \"'protos.h'\" unpacked with wrong size!
  2318. fi
  2319. # end of 'protos.h'
  2320. fi
  2321. if test -f 'utils.c' -a "${1}" != "-c" ; then 
  2322.   echo shar: Will not clobber existing file \"'utils.c'\"
  2323. else
  2324. echo shar: Extracting \"'utils.c'\" \(10124 characters\)
  2325. sed "s/^X//" >'utils.c' <<'END_OF_FILE'
  2326. X/* $RCSfile: utils.c,v $  $Revision: 2.0 $ */
  2327. X
  2328. X#include <stdio.h>
  2329. X#include "gdefs.h"
  2330. X#include "externals.h"
  2331. X#include "protos.h"
  2332. Xextern FILE *ifile,*ofile;
  2333. X
  2334. Xstatic int begin_or_end = FALSE;    /* Variable used between 
  2335. X                                       print_char and print_chars */
  2336. X
  2337. Xvoid err_exit(int x)
  2338. X{
  2339. X    printf(err_msg[x]);
  2340. X    exit(x);
  2341. X}
  2342. X
  2343. Xvoid print_hex(int i)
  2344. X{
  2345. X    if ((i>=0) && (i<=9)) {
  2346. X        fputc(i+'0',ofile);
  2347. X    }
  2348. X    else if ((i>=10) && (i<=15)) {
  2349. X        fputc(i+'A'-10,ofile);
  2350. X    }
  2351. X    else printf("\nERROR: i= %d\n",i);
  2352. X}
  2353. X
  2354. Xvoid output_byte(int c)
  2355. X{
  2356. X    int i,j,k;
  2357. X    i=c;
  2358. X    j=i / 16;
  2359. X    k=i % 16;
  2360. X    print_hex(j);
  2361. X    print_hex(k);
  2362. X}
  2363. X
  2364. Xvoid indent(int x)
  2365. X{
  2366. X    int i;
  2367. X
  2368. X    /* Default is to indent 4 spaces */
  2369. X    if (x != 0) {
  2370. X        for (i=0; i<x; i++) {
  2371. X            /* Insert favorite tabbing style */
  2372. X            fprintf(ofile,"    ");
  2373. X        }
  2374. X    }
  2375. X}
  2376. X
  2377. X/* ROUTINE: print_esc_string
  2378. X *
  2379. X *    This routine prints the entire escape sequence string.  If the
  2380. X *    hex option is used, a hex printout of the string is also given.
  2381. X */
  2382. Xvoid print_esc_string(void)
  2383. X{
  2384. X
  2385. X    fprintf(ofile,"\n<Esc>%s\n", &esc_string[1]);
  2386. X    if (opt_x) {
  2387. X        int i,j;
  2388. X        /* Print the characters in hex */
  2389. X        for (i=0; i <= esc_count; i++) {
  2390. X            j = 0xff & esc_string[i];
  2391. X            output_byte(j);
  2392. X            fprintf(ofile," ");
  2393. X        }
  2394. X        fprintf(ofile,"\n");
  2395. X    }
  2396. X}
  2397. X
  2398. X/* ROUTINE: print_sub_string
  2399. X *
  2400. X *    This routine prints part of the escape sequence string.
  2401. X *    This consists of the "header" which is the first header characters
  2402. X *    after the escape.  Then the string between start and stop is printed.
  2403. X */
  2404. Xvoid print_sub_string(int header, int start, int stop)
  2405. X{
  2406. X    int i;
  2407. X    char s[255];
  2408. X    char    *ptr_c;
  2409. X
  2410. X    ptr_c = s;
  2411. X    for (i=1; i<=header; i++) {
  2412. X        *ptr_c++ = esc_string[i];
  2413. X    }
  2414. X    for (i=start; i<=stop; i++) {
  2415. X        *ptr_c++ = esc_string[i];
  2416. X    }
  2417. X    *ptr_c = 0;
  2418. X    indent(1);
  2419. X    fprintf(ofile,"<Esc>%-6s ", s);
  2420. X}
  2421. X
  2422. X/* ROUTINE: get_num
  2423. X *
  2424. X *    Convert an alpha number sequence to an actual int.  
  2425. X *
  2426. X * Variables used:
  2427. X *    stop_pos  -- *stop_pos contains the starting point on 
  2428. X *                 entry and is updated to the new "stop point"
  2429. X *                 before exiting.
  2430. X *    num       -- global variable used to return the integer value.
  2431. X *    fraction  -- global string used to return fractional part (if exists)
  2432. X *    is_float  -- global flag to say that fractional part exists.
  2433. X *    plus      -- global flag to say number started with a '+' sign.
  2434. X *    minus     -- global flag to say number started with a '-' sign.
  2435. X *    
  2436. X * NOTES:
  2437. X *    Pcl assumes a zero if no number is given.  Thus, this routine returns
  2438. X *    a zero if '0' is encountered or if no digits are encountered.
  2439. X *    
  2440. X *    If the fractional part of a floating point number is zero, the
  2441. X *    number will be treated like an int.
  2442. X */
  2443. Xvoid get_num(int *stop_pos, int sum)
  2444. X{
  2445. X    char c;
  2446. X    int  done;
  2447. X    int  i,j;
  2448. X
  2449. X    i = *stop_pos;
  2450. X    c = esc_string[i];
  2451. X    plus = minus = is_float = FALSE;
  2452. X    if (c == '-') {
  2453. X        minus = TRUE;
  2454. X        i++;
  2455. X    }
  2456. X    else if (c == '+') {
  2457. X        i++;
  2458. X        plus = TRUE;
  2459. X    }
  2460. X    done = FALSE;
  2461. X    while (done == FALSE) {
  2462. X        c = esc_string[i];
  2463. X        if ((c >= '0') && (c <= '9')) {
  2464. X            sum *= 10;
  2465. X            sum += c - '0';
  2466. X            i++;
  2467. X        }
  2468. X        else done = TRUE;
  2469. X    }
  2470. X    if (c == '.') {
  2471. X        i++;
  2472. X        done = FALSE;
  2473. X        j = 0;
  2474. X        while (done == FALSE) {
  2475. X            c = esc_string[i];
  2476. X            if ((c >= '0') && (c <= '9')) {
  2477. X                fraction[j] = c;
  2478. X                i++;
  2479. X                j++;
  2480. X            }
  2481. X            else done = TRUE;
  2482. X        }
  2483. X        /* Remove trailing 0's and see if anything's left */
  2484. X        if (j > 0) {
  2485. X            done = FALSE;
  2486. X            while (done == FALSE) {
  2487. X                fraction[j] = 0;
  2488. X                if ((j == 0) || (fraction[j-1] != '0')) {
  2489. X                    done = TRUE;
  2490. X                }
  2491. X                else {
  2492. X                    j--;
  2493. X                }
  2494. X            }
  2495. X            if (j != 0) {
  2496. X                is_float = TRUE;
  2497. X            }
  2498. X        }
  2499. X    }
  2500. X    *stop_pos = i;
  2501. X    if (minus) {
  2502. X        sum = -sum;
  2503. X    }
  2504. X    num = sum;
  2505. X}
  2506. X
  2507. X/*
  2508. X * ROUTINE: decode_esc_string
  2509. X *
  2510. X *   This routine provides the first level of decoding for an escape
  2511. X *   string.  If it is a simple 2 character escape sequence, it is
  2512. X *   handled here.  Otherwise, the appropriate lower level routine
  2513. X *   is called.
  2514. X */
  2515. Xvoid decode_esc_string(void)
  2516. X{
  2517. X    char c;
  2518. X
  2519. X    c = esc_string[1];
  2520. X    if (esc_count == 1) {
  2521. X        indent(1);
  2522. X        fprintf(ofile,"<Esc>%-6s ", &esc_string[1]);
  2523. X        switch (c) {
  2524. X            case '9':
  2525. X                fprintf(ofile,
  2526. X                    "Reset Left and Right Margins to default settings.\n");
  2527. X                break;
  2528. X            case '=':
  2529. X                fprintf(ofile,"Half Line Feed.  Move down one-half line.\n");
  2530. X                break;
  2531. X            case 'E':
  2532. X                fprintf(ofile,"Reset to user defaults.\n");
  2533. X                indent(4);
  2534. X                fprintf(ofile,
  2535. X                    "Print buffered page.  Delete temporary fonts and macros.\n");
  2536. X                break;
  2537. X            case 'Y':
  2538. X                fprintf(ofile,"Display Functions ON.\n");
  2539. X                break; 
  2540. X            case 'Z':
  2541. X                fprintf(ofile,"Display Functions OFF.\n");
  2542. X                break;
  2543. X            case 'z':
  2544. X                fprintf(ofile,"Print Self Test.\n");
  2545. X                break;
  2546. X            default:
  2547. X                fprintf(ofile,"%s",bad_esc);
  2548. X                break;
  2549. X        }
  2550. X    }
  2551. X    else {
  2552. X        switch (c) {
  2553. X            case '(':
  2554. X            case ')':
  2555. X                decode_paren();
  2556. X                break;
  2557. X            case '&':
  2558. X                decode_ampersand();
  2559. X                break;
  2560. X            case '*':
  2561. X                decode_asterisk();
  2562. X                break;
  2563. X            default:
  2564. X                fprintf(ofile,"%s",bad_esc);
  2565. X                break;
  2566. X        }
  2567. X    }
  2568. X}
  2569. X
  2570. X/* ROUTINE: add_char
  2571. X *
  2572. X *    This routine places a character into a buffer when we are in
  2573. X *    character mode.  The idea is to store the first (typically 10)
  2574. X *    characters and last (again typically 10) characters.  Thus, if
  2575. X *    we encounter a big text section, we don't have to print the whole
  2576. X *    thing.  The first characters are placed in the char_start
  2577. X *    array.  The last characters are placed in the char_end array which
  2578. X *    is a circular buffer.
  2579. X */
  2580. Xvoid add_char(int c)
  2581. X{
  2582. X    if (opt_e == FALSE) {
  2583. X        if (char_count <= CHAR_START_LEN + CHAR_END_LEN - 1) {
  2584. X            char_start[char_count] = c;
  2585. X        }
  2586. X        if (char_count >= CHAR_START_LEN) {
  2587. X            char_end[(char_count - CHAR_START_LEN) % CHAR_END_LEN] = c;
  2588. X        }
  2589. X        char_count++;
  2590. X    }
  2591. X}
  2592. X
  2593. X/* ROUTINE: print_extra_rasters
  2594. X *
  2595. X *    Raster images are printed a line at a time.  Rather than print
  2596. X *    each raster escape sequence, the first is simply printed, and
  2597. X *    all others that follow of the same size are counted, and the
  2598. X *    additional count is printed with this routine.
  2599. X */
  2600. Xvoid print_extra_rasters(void)
  2601. X{
  2602. X    if ((raster_mode != NO_RASTER) && (raster_count > 0)) {
  2603. X        indent(1);
  2604. X        fprintf(ofile,"%d same size raster commands follow.\n",raster_count);
  2605. X    }
  2606. X    raster_mode = NO_RASTER;
  2607. X    raster_count = 0;
  2608. X}
  2609. X
  2610. X/* ROUTINE: print_char
  2611. X *
  2612. X *    This routine prints a character that was encountered in character
  2613. X *    mode.  Some special characters are expressed mnemonically between
  2614. X *    brackets.  Other (typically) non-printing characters are represented
  2615. X *    by their hex character codes in brackets.  The space character gets 
  2616. X *    some extra special treatment.  In cases at the beginning or end of 
  2617. X *    strings, where it might not be visually obvious, a <SP> is printed
  2618. X *    instead.  The begin_or_end variable is used between this routine 
  2619. X *    and print_chars to convey this information and is always cleared
  2620. X *    on exit from this routine.
  2621. X */
  2622. Xvoid print_char(char c)
  2623. X{
  2624. X    char s[2];
  2625. X
  2626. X    switch (c) {
  2627. X        case CARRIAGE_RETURN:
  2628. X            fprintf(ofile,"<CR>");
  2629. X            break;
  2630. X        case LINE_FEED:
  2631. X            fprintf(ofile,"<LF>");
  2632. X            break;
  2633. X        case BACK_SPACE:
  2634. X            fprintf(ofile,"<BS>");
  2635. X            break;
  2636. X        case TAB:
  2637. X            fprintf(ofile,"<TAB>");
  2638. X            break;
  2639. X        case ' ':
  2640. X            if (begin_or_end) {
  2641. X                fprintf(ofile,"<SP>");
  2642. X            }
  2643. X            else {
  2644. X                fprintf(ofile," ");
  2645. X            }
  2646. X            break;
  2647. X        default:
  2648. X            if (((c >= 32) && (c <= 127)) || ((c >= 161) && (c <= 254))) {
  2649. X                s[0]=c;
  2650. X                s[1]=0;
  2651. X                fprintf(ofile,"%s",s);
  2652. X            }
  2653. X            else {
  2654. X                /* Non-printing characters in Roman-8 character set */
  2655. X                /* Hopefully one won't see much of these */
  2656. X                fprintf(ofile,"<0x%x>",0xff & c);
  2657. X            }
  2658. X            break;
  2659. X    }
  2660. X    begin_or_end = FALSE;
  2661. X}
  2662. X
  2663. X/*
  2664. X * ROUTINE: print_chars
  2665. X *     Prints the first (10) characters and last (10) characters of text 
  2666. X *
  2667. X * NOTES:
  2668. X *     Uses the following forms:
  2669. X *        <=20 chars "123456789ab"  
  2670. X *         >20 chars "123456789a ... 123456789a"  
  2671. X *     Will also print additional line info when lines have been skipped.
  2672. X *     Special characters will come out between <>'s.  If you are unsure
  2673. X *     if <>'s were in your text, count the number of characters printed.
  2674. X *     Spaces on "ends" of text will come out as <SP>.
  2675. X *     The actual number of characters printed depends on CHAR_START_LEN
  2676. X *     and CHAR_END_LEN.
  2677. X *     Will print the hex equivalents if -x option used.
  2678. X */
  2679. Xvoid print_chars(void)
  2680. X{
  2681. X    int i,j,k;
  2682. X
  2683. X    print_extra_rasters();
  2684. X    if (opt_e == FALSE) {
  2685. X        if (char_count > 0) {
  2686. X            fprintf(ofile,"\n");
  2687. X            if (char_count <= CHAR_START_LEN + CHAR_END_LEN) {
  2688. X                /* Only print (some of the) start characters */
  2689. X                begin_or_end = TRUE;
  2690. X                for (i=0; i<char_count; i++) {
  2691. X                    if (i == char_count-1) {
  2692. X                        begin_or_end = TRUE;
  2693. X                    }
  2694. X                    print_char(char_start[i]);
  2695. X                }
  2696. X                if (opt_x) {
  2697. X                    fprintf(ofile,"\n");
  2698. X                    for (i=0; i<char_count; i++) {
  2699. X                        j = 0xff & char_start[i];
  2700. X                        output_byte(j);
  2701. X                        fprintf(ofile," ");
  2702. X                    }
  2703. X                }
  2704. X            }
  2705. X            else { 
  2706. X                /* "End" array did "wrap around" */
  2707. X                /* Move the "end" characters to end of "start" array */
  2708. X                j = k = (char_count - CHAR_START_LEN) % CHAR_END_LEN;
  2709. X                for (i=CHAR_START_LEN; k<CHAR_END_LEN; i++, k++) {
  2710. X                    char_start[i] = char_end[k];
  2711. X                }
  2712. X                for (k=0; k<j; i++, k++) {
  2713. X                    char_start[i] = char_end[k];
  2714. X                }
  2715. X                begin_or_end = TRUE;
  2716. X                /* Print the first set */
  2717. X                for (i=0; i<CHAR_START_LEN; i++) {
  2718. X                    if (i == CHAR_START_LEN-1) {
  2719. X                        begin_or_end = TRUE;
  2720. X                    }
  2721. X                    print_char(char_start[i]);
  2722. X                }
  2723. X                fprintf(ofile," ... ");
  2724. X                begin_or_end = TRUE;
  2725. X                /* Print the second set */
  2726. X                for (i=CHAR_START_LEN; i<CHAR_START_LEN+CHAR_END_LEN; i++) {
  2727. X                    if (i == CHAR_START_LEN+CHAR_END_LEN-1) {
  2728. X                        begin_or_end = TRUE;
  2729. X                    }
  2730. X                    print_char(char_start[i]);
  2731. X                }
  2732. X                if (opt_x) {
  2733. X                    fprintf(ofile,"\n");
  2734. X                    for (i=0; i<CHAR_START_LEN; i++) {
  2735. X                        j = 0xff & char_start[i];
  2736. X                        output_byte(j);
  2737. X                        fprintf(ofile," ");
  2738. X                    }
  2739. X                    fprintf(ofile," ... ");
  2740. X                    for (i=CHAR_START_LEN; i<CHAR_START_LEN+CHAR_END_LEN; i++) {
  2741. X                        j = 0xff & char_start[i];
  2742. X                        output_byte(j);
  2743. X                        fprintf(ofile," ");
  2744. X                    }
  2745. X                }
  2746. X            }
  2747. X            fprintf(ofile,"\n");
  2748. X            if (num_lines > 0) {
  2749. X                indent(1);
  2750. X                fprintf(ofile,"Added %d more lines.\n", num_lines);
  2751. X            }
  2752. X        }
  2753. X    }
  2754. X    num_lines = char_count = 0;
  2755. X}
  2756. END_OF_FILE
  2757. if test 10124 -ne `wc -c <'utils.c'`; then
  2758.     echo shar: \"'utils.c'\" unpacked with wrong size!
  2759. fi
  2760. # end of 'utils.c'
  2761. fi
  2762. echo shar: End of archive 1 \(of 2\).
  2763. cp /dev/null ark1isdone
  2764. MISSING=""
  2765. for I in 1 2 ; do
  2766.     if test ! -f ark${I}isdone ; then
  2767.     MISSING="${MISSING} ${I}"
  2768.     fi
  2769. done
  2770. if test "${MISSING}" = "" ; then
  2771.     echo You have unpacked both archives.
  2772.     rm -f ark[1-9]isdone
  2773. else
  2774.     echo You still need to unpack the following archives:
  2775.     echo "        " ${MISSING}
  2776. fi
  2777. ##  End of shell archive.
  2778. exit 0
  2779. -- 
  2780. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  2781. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  2782. Post requests for sources, and general discussion to comp.sys.amiga.
  2783.